mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-10 01:17:44 +03:00
mount-util: make umount_and_rmdir_and_freep() cleanup handler deal with NULL
This commit is contained in:
parent
fd2f6f7248
commit
4d686e6b0b
@ -93,8 +93,10 @@ int mode_to_inaccessible_node(const char *runtime_dir, mode_t mode, char **dest)
|
||||
/* Useful for usage with _cleanup_(), unmounts, removes a directory and frees the pointer */
|
||||
static inline char* umount_and_rmdir_and_free(char *p) {
|
||||
PROTECT_ERRNO;
|
||||
(void) umount_recursive(p, 0);
|
||||
(void) rmdir(p);
|
||||
if (p) {
|
||||
(void) umount_recursive(p, 0);
|
||||
(void) rmdir(p);
|
||||
}
|
||||
return mfree(p);
|
||||
}
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, umount_and_rmdir_and_free);
|
||||
|
Loading…
Reference in New Issue
Block a user