Make sure to not leak the file descriptor in the upload() function, in
case lseek() fails.
---
daemon/upload.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/daemon/upload.c b/daemon/upload.c
index 9de855f86..540a86437 100644
--- a/daemon/upload.c
+++ b/daemon/upload.c
@@ -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;
--
2.14.3
Show replies by date