X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fbasic%2Ffs-util.h;fp=src%2Fbasic%2Ffs-util.h;h=60f465a4d919bf2a301bdd66c916c6994b732a29;hp=3f47537de147fb2b0689cc89f238f3596ccf7f16;hb=1fb53ab1ff945fd78916943a46437dd21f02caf0;hpb=24559fa35120aa9748cfac4c738b4dbabb122e15 diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h index 3f47537de..60f465a4d 100644 --- a/src/basic/fs-util.h +++ b/src/basic/fs-util.h @@ -104,3 +104,9 @@ static inline void rmdir_and_free(char *p) { free(p); } DEFINE_TRIVIAL_CLEANUP_FUNC(char*, rmdir_and_free); + +static inline void unlink_and_free(char *p) { + (void) unlink(p); + free(p); +} +DEFINE_TRIVIAL_CLEANUP_FUNC(char*, unlink_and_free);