summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-01-19 11:30:23 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-01-23 18:16:14 +0000
commit082e6cfca95645e6348eab13e6b2b31ffd41787a (patch)
treebbbeb4944ba1c4c997e10e903a7ba1d88847531e
parent154e9426441e93d42a5e98c394433e284297543d (diff)
downloadlibguestfs-082e6cfca95645e6348eab13e6b2b31ffd41787a.tar.gz
libguestfs-082e6cfca95645e6348eab13e6b2b31ffd41787a.tar.xz
libguestfs-082e6cfca95645e6348eab13e6b2b31ffd41787a.zip
daemon: pwrite/pread: Don't double close on error path.
In Linux, close (fd) closes the file descriptor even if it returns an error. (cherry picked from commit 61abcf71c05c07bfaca96666b16a0bc30a6edab4)
-rw-r--r--daemon/file.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/daemon/file.c b/daemon/file.c
index 0f27b68d..f0389196 100644
--- a/daemon/file.c
+++ b/daemon/file.c
@@ -483,7 +483,6 @@ pread_fd (int fd, int count, int64_t offset, size_t *size_r,
if (close (fd) == -1) {
reply_with_perror ("close: %s", display_path);
- close (fd);
free (buf);
return NULL;
}
@@ -539,7 +538,6 @@ pwrite_fd (int fd, const char *content, size_t size, int64_t offset,
if (close (fd) == -1) {
reply_with_perror ("close: %s", display_path);
- close (fd);
return -1;
}