[Pkg-libvirt-commits] [libguestfs] 136/156: utils: Add new CLEANUP_PCLOSE cleanup. It calls pclose(3).
Hilko Bengen
bengen at moszumanska.debian.org
Sat Aug 30 08:26:14 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch master
in repository libguestfs.
commit 08a0099c9b2d808ad396b7b42ed312250872b0f1
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Thu Aug 14 17:34:39 2014 +0100
utils: Add new CLEANUP_PCLOSE cleanup. It calls pclose(3).
(cherry picked from commit 9fa9d39d71af63fe96a95ea5668c14b73555c348)
---
src/cleanup.c | 9 +++++++++
src/guestfs-internal-frontend.h | 3 +++
2 files changed, 12 insertions(+)
diff --git a/src/cleanup.c b/src/cleanup.c
index 4e1a7f9..60e660f 100644
--- a/src/cleanup.c
+++ b/src/cleanup.c
@@ -131,3 +131,12 @@ guestfs___cleanup_fclose (void *ptr)
if (f)
fclose (f);
}
+
+void
+guestfs___cleanup_pclose (void *ptr)
+{
+ FILE *f = * (FILE **) ptr;
+
+ if (f)
+ pclose (f);
+}
diff --git a/src/guestfs-internal-frontend.h b/src/guestfs-internal-frontend.h
index 1e59ad1..20331c8 100644
--- a/src/guestfs-internal-frontend.h
+++ b/src/guestfs-internal-frontend.h
@@ -56,6 +56,7 @@
#define CLEANUP_XMLXPATHFREEOBJECT \
__attribute__((cleanup(guestfs___cleanup_xmlXPathFreeObject)))
#define CLEANUP_FCLOSE __attribute__((cleanup(guestfs___cleanup_fclose)))
+#define CLEANUP_PCLOSE __attribute__((cleanup(guestfs___cleanup_pclose)))
#else
#define CLEANUP_FREE
#define CLEANUP_FREE_STRING_LIST
@@ -68,6 +69,7 @@
#define CLEANUP_XMLXPATHFREECONTEXT
#define CLEANUP_XMLXPATHFREEOBJECT
#define CLEANUP_FCLOSE
+#define CLEANUP_PCLOSE
#endif
/* NB: At some point we will stop exporting these safe_* allocation
@@ -118,6 +120,7 @@ extern void guestfs___cleanup_xmlFreeTextWriter (void *ptr);
extern void guestfs___cleanup_xmlXPathFreeContext (void *ptr);
extern void guestfs___cleanup_xmlXPathFreeObject (void *ptr);
extern void guestfs___cleanup_fclose (void *ptr);
+extern void guestfs___cleanup_pclose (void *ptr);
/* These are in a separate header so the header can be generated.
* Don't include the following file directly:
--
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