diff options
Diffstat (limited to 'src/basic/fs-util.h')
-rw-r--r-- | src/basic/fs-util.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h index 0d925c6b84..5fe5c71ff0 100644 --- a/src/basic/fs-util.h +++ b/src/basic/fs-util.h @@ -84,3 +84,10 @@ enum { }; int chase_symlinks(const char *path_with_prefix, const char *root, unsigned flags, char **ret); + +/* Useful for usage with _cleanup_(), removes a directory and frees the pointer */ +static inline void rmdir_and_free(char *p) { + (void) rmdir(p); + free(p); +} +DEFINE_TRIVIAL_CLEANUP_FUNC(char*, rmdir_and_free); |