]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
install: use null_or_empty_path() 18873/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Mar 2021 08:21:22 +0000 (17:21 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Mar 2021 23:09:05 +0000 (08:09 +0900)
src/shared/install.c

index 183da5865e0247914fae5a2be8e6e1d08605bb6c..0f18b1bb05352e6b4b132994a230020c86261bb2 100644 (file)
@@ -1335,8 +1335,8 @@ static int unit_file_load_or_readlink(
                 const char *path,
                 const char *root_dir,
                 SearchFlags flags) {
+
         _cleanup_free_ char *resolved = NULL;
-        struct stat st;
         int r;
 
         r = unit_file_load(c, info, path, root_dir, flags);
@@ -1351,9 +1351,7 @@ static int unit_file_load_or_readlink(
                  * so let's see if the path is a (possibly dangling) symlink to /dev/null. */
                 info->type = UNIT_FILE_TYPE_MASKED;
 
-        else if (r > 0 &&
-                 stat(resolved, &st) >= 0 &&
-                 null_or_empty(&st))
+        else if (r > 0 && null_or_empty_path(resolved) > 0)
 
                 info->type = UNIT_FILE_TYPE_MASKED;