execute: share error path between reg file/dir credential loading
authorLennart Poettering <lennart@poettering.net>
Wed, 13 Apr 2022 21:07:26 +0000 (23:07 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 22 Apr 2022 09:32:47 +0000 (11:32 +0200)
src/core/execute.c

index f93c7b7992771136dbef9ea160af0f9699a9ab58..a16dbdd0c7874ff9d57a2ea84a52932d185a6dbd 100644 (file)
@@ -2793,9 +2793,8 @@ static int acquire_credentials(
                 if (sub_fd < 0 && errno != ENOTDIR)
                         return -errno;
 
-                if (sub_fd < 0) {
+                if (sub_fd < 0)
                         /* Regular file */
-
                         r = load_credential(
                                         context,
                                         params,
@@ -2808,12 +2807,8 @@ static int acquire_credentials(
                                         uid,
                                         ownership_ok,
                                         &left);
-                        if (r < 0)
-                                return r;
-
-                } else {
+                else
                         /* Directory */
-
                         r = recurse_dir(
                                         sub_fd,
                                         /* path= */ lc->id, /* recurse_dir() will suffix the subdir paths from here to the top-level id */
@@ -2831,9 +2826,8 @@ static int acquire_credentials(
                                                 .ownership_ok = ownership_ok,
                                                 .left = &left,
                                         });
-                        if (r < 0)
-                                return r;
-                }
+                if (r < 0)
+                        return r;
         }
 
         /* Second, we add in literally specified credentials. If the credentials already exist, we'll not add