mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
daemon: make aug_close cleanup available for all
Just code motion, no behaviour changes.
This commit is contained in:
@@ -176,6 +176,7 @@ extern void cleanup_free (void *ptr);
|
||||
extern void cleanup_free_string_list (void *ptr);
|
||||
extern void cleanup_unlink_free (void *ptr);
|
||||
extern void cleanup_close (void *ptr);
|
||||
extern void cleanup_aug_close (void *ptr);
|
||||
|
||||
/*-- in names.c (auto-generated) --*/
|
||||
extern const char *function_names[];
|
||||
@@ -426,11 +427,13 @@ is_zero (const char *buffer, size_t size)
|
||||
__attribute__((cleanup(cleanup_free_string_list)))
|
||||
#define CLEANUP_UNLINK_FREE __attribute__((cleanup(cleanup_unlink_free)))
|
||||
#define CLEANUP_CLOSE __attribute__((cleanup(cleanup_close)))
|
||||
#define CLEANUP_AUG_CLOSE __attribute__((cleanup(cleanup_aug_close)))
|
||||
#else
|
||||
#define CLEANUP_FREE
|
||||
#define CLEANUP_FREE_STRING_LIST
|
||||
#define CLEANUP_UNLINK_FREE
|
||||
#define CLEANUP_CLOSE
|
||||
#define CLEANUP_AUG_CLOSE
|
||||
#endif
|
||||
|
||||
#endif /* GUESTFSD_DAEMON_H */
|
||||
|
||||
@@ -47,6 +47,8 @@
|
||||
# include <printf.h>
|
||||
#endif
|
||||
|
||||
#include <augeas.h>
|
||||
|
||||
#include "sockets.h"
|
||||
#include "c-ctype.h"
|
||||
#include "ignore-value.h"
|
||||
@@ -1511,3 +1513,12 @@ cleanup_close (void *ptr)
|
||||
if (fd >= 0)
|
||||
close (fd);
|
||||
}
|
||||
|
||||
void
|
||||
cleanup_aug_close (void *ptr)
|
||||
{
|
||||
augeas *aug = * (augeas **) ptr;
|
||||
|
||||
if (aug != NULL)
|
||||
aug_close (aug);
|
||||
}
|
||||
|
||||
@@ -33,22 +33,6 @@
|
||||
#include "daemon.h"
|
||||
#include "actions.h"
|
||||
|
||||
#ifdef HAVE_ATTRIBUTE_CLEANUP
|
||||
#define CLEANUP_AUG_CLOSE __attribute__((cleanup(cleanup_aug_close)))
|
||||
|
||||
static void
|
||||
cleanup_aug_close (void *ptr)
|
||||
{
|
||||
augeas *aug = * (augeas **) ptr;
|
||||
|
||||
if (aug != NULL)
|
||||
aug_close (aug);
|
||||
}
|
||||
|
||||
#else
|
||||
#define CLEANUP_AUG_CLOSE
|
||||
#endif
|
||||
|
||||
GUESTFSD_EXT_CMD(str_lvm, lvm);
|
||||
GUESTFSD_EXT_CMD(str_cp, cp);
|
||||
GUESTFSD_EXT_CMD(str_rm, rm);
|
||||
|
||||
Reference in New Issue
Block a user