mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +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.
This commit is contained in:
committed by
Richard W.M. Jones
parent
5ddef548b0
commit
fced132718
@@ -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