]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/home/homework-mount.c
tree-wide: use -EBADF for fd initialization
[thirdparty/systemd.git] / src / home / homework-mount.c
index cd03f79a7398ee22b99f7c917e64980bb7082a56..cf42a0b94dfae6e7aa3254db66eadfa80ac6b464 100644 (file)
@@ -186,7 +186,7 @@ static int append_identity_range(char **text, uid_t start, uid_t next_start, uid
 
 static int make_userns(uid_t stored_uid, uid_t exposed_uid) {
         _cleanup_free_ char *text = NULL;
-        _cleanup_close_ int userns_fd = -1;
+        _cleanup_close_ int userns_fd = -EBADF;
         int r;
 
         assert(uid_is_valid(stored_uid));
@@ -238,7 +238,7 @@ static int make_userns(uid_t stored_uid, uid_t exposed_uid) {
 }
 
 int home_shift_uid(int dir_fd, const char *target, uid_t stored_uid, uid_t exposed_uid, int *ret_mount_fd) {
-        _cleanup_close_ int mount_fd = -1, userns_fd = -1;
+        _cleanup_close_ int mount_fd = -EBADF, userns_fd = -EBADF;
         int r;
 
         assert(dir_fd >= 0);
@@ -261,7 +261,7 @@ int home_shift_uid(int dir_fd, const char *target, uid_t stored_uid, uid_t expos
                         log_debug_errno(errno, "The open_tree() syscall is not supported, not setting up UID shift mount: %m");
 
                         if (ret_mount_fd)
-                                *ret_mount_fd = -1;
+                                *ret_mount_fd = -EBADF;
 
                         return 0;
                 }
@@ -284,7 +284,7 @@ int home_shift_uid(int dir_fd, const char *target, uid_t stored_uid, uid_t expos
                         log_debug_errno(errno, "UID/GID mapping for shifted mount not available, not setting it up: %m");
 
                         if (ret_mount_fd)
-                                *ret_mount_fd = -1;
+                                *ret_mount_fd = -EBADF;
 
                         return 0;
                 }