summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-01-24 16:42:05 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-01-24 17:00:36 +0000
commit94a7fb9fc5d04615f23f94c34eb90c35d20ba117 (patch)
treee640195a986826499ad1a747c4d134385b272b23
parentff2e685828ce6160de34756696069b80e35472e8 (diff)
downloadlibguestfs-94a7fb9fc5d04615f23f94c34eb90c35d20ba117.tar.gz
libguestfs-94a7fb9fc5d04615f23f94c34eb90c35d20ba117.tar.xz
libguestfs-94a7fb9fc5d04615f23f94c34eb90c35d20ba117.zip
daemon: Close augeas handle on exit.
-rw-r--r--daemon/augeas.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/daemon/augeas.c b/daemon/augeas.c
index 03cba421..83d24ad3 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) { \