[Libguestfs] [PATCH 11/14] daemon: Close augeas handle on exit.

Richard W.M. Jones rjones at redhat.com
Tue Jan 24 17:02:25 UTC 2012


From: "Richard W.M. Jones" <rjones at redhat.com>

---
 daemon/augeas.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/daemon/augeas.c b/daemon/augeas.c
index 03cba42..83d24ad 100644
--- a/daemon/augeas.c
+++ b/daemon/augeas.c
@@ -38,6 +38,17 @@
  */
 static augeas *aug = NULL;
 
+/* Clean up the augeas handle on daemon exit. */
+static void aug_finalize (void) __attribute__((destructor));
+static void
+aug_finalize (void)
+{
+  if (aug) {
+    aug_close (aug);
+    aug = NULL;
+  }
+}
+
 #define NEED_AUG(errcode)						\
   do {									\
     if (!aug) {								\
-- 
1.7.6




More information about the Libguestfs mailing list