[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



From: "Richard W.M. Jones" <rjones 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]