shared/mount-util: return early if param is NULL

To make things more readable and consistent.
This commit is contained in:
Mike Yuan
2024-07-01 18:59:28 +02:00
parent 1c30bf35bc
commit 71c404f9cf
+10 -7
View File
@@ -83,19 +83,22 @@ int mount_flags_to_string(unsigned long flags, char **ret);
/* Useful for usage with _cleanup_(), unmounts, removes a directory and frees the pointer */
static inline char* umount_and_rmdir_and_free(char *p) {
if (!p)
return NULL;
PROTECT_ERRNO;
if (p) {
(void) umount_recursive(p, 0);
(void) rmdir(p);
}
(void) umount_recursive(p, 0);
(void) rmdir(p);
return mfree(p);
}
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, umount_and_rmdir_and_free);
static inline char *umount_and_free(char *p) {
static inline char* umount_and_free(char *p) {
if (!p)
return NULL;
PROTECT_ERRNO;
if (p)
(void) umount_recursive(p, 0);
(void) umount_recursive(p, 0);
return mfree(p);
}
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, umount_and_free);