1
1
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 05:11:06 +02:00

fix: accidentally overwritten error value

In function _cli.send_ the named return value 'err' gets accidentally
overwritten in the deferred anonymous function that removes the
files/directories. Renamed the error variable inside the deferred
function so that it does not overwrite the original error anymore.

Closes #296
This commit is contained in:
Niko Köser 2021-02-01 10:34:06 +01:00
parent 493eb075f1
commit 3ccd4d07e9
No known key found for this signature in database
GPG key ID: F3F28C118DAA6375

View file

@ -223,9 +223,9 @@ func send(c *cli.Context) (err error) {
return
}
defer func() {
err = os.Remove(fnames[0])
if err != nil {
log.Error(err)
e := os.Remove(fnames[0])
if e != nil {
log.Error(e)
}
}()
} else if c.String("text") != "" {
@ -234,9 +234,9 @@ func send(c *cli.Context) (err error) {
return
}
defer func() {
err = os.Remove(fnames[0])
if err != nil {
log.Error(err)
e := os.Remove(fnames[0])
if e != nil {
log.Error(e)
}
}()