mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
daemon: upload: fix fd leak on lseek failure
Make sure to not leak the file descriptor in the upload() function, in
case lseek() fails.
(cherry picked from commit fced132718)
This commit is contained in:
committed by
Richard W.M. Jones
parent
62b59441e3
commit
0fdf1b6269
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user