[Pkg-libvirt-commits] [libguestfs] 69/266: daemon: use CLEANUP_CLOSE

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 3 14:41:43 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag debian/1%1.27.35-1
in repository libguestfs.

commit bb124552155667c082c075cb09267b12a7a567c1
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Fri Aug 8 15:35:02 2014 +0200

    daemon: use CLEANUP_CLOSE
---
 daemon/checksum.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/daemon/checksum.c b/daemon/checksum.c
index 019c04c..6ec48c0 100644
--- a/daemon/checksum.c
+++ b/daemon/checksum.c
@@ -72,10 +72,8 @@ checksum (const char *csumtype, int fd)
   size_t len;
 
   program = program_of_csum (csumtype);
-  if (program == NULL) {
-    close (fd);
+  if (program == NULL)
     return NULL;
-  }
 
   pulse_mode_start ();
 
@@ -100,7 +98,7 @@ checksum (const char *csumtype, int fd)
 char *
 do_checksum (const char *csumtype, const char *path)
 {
-  int fd;
+  CLEANUP_CLOSE int fd = -1;
 
   CHROOT_IN;
   fd = open (path, O_RDONLY|O_CLOEXEC);
@@ -117,7 +115,7 @@ do_checksum (const char *csumtype, const char *path)
 char *
 do_checksum_device (const char *csumtype, const char *device)
 {
-  int fd;
+  CLEANUP_CLOSE int fd = -1;
 
   fd = open (device, O_RDONLY|O_CLOEXEC);
   if (fd == -1) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list