daemon: upload: fix fd leak on lseek failure

Make sure to not leak the file descriptor in the upload() function, in
case lseek() fails.
This commit is contained in:
Pino Toscano
2018-04-30 13:07:50 +02:00
committed by Richard W.M. Jones
parent 5ddef548b0
commit fced132718

View File

@@ -111,6 +111,7 @@ upload (const char *filename, int flags, int64_t offset)
if (lseek (fd, offset, SEEK_SET) == -1) {
err = errno;
ignore_value (cancel_receive ());
close (fd);
errno = err;
reply_with_perror ("lseek: %s", filename);
return -1;