From 94a7fb9fc5d04615f23f94c34eb90c35d20ba117 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 24 Jan 2012 16:42:05 +0000 Subject: [PATCH] daemon: Close augeas handle on exit. --- daemon/augeas.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/daemon/augeas.c b/daemon/augeas.c index 03cba42118..83d24ad3fc 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) { \