From: Yu Watanabe Date: Thu, 4 Mar 2021 08:21:22 +0000 (+0900) Subject: install: use null_or_empty_path() X-Git-Tag: v248-rc3~54^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F18873%2Fhead;p=thirdparty%2Fsystemd.git install: use null_or_empty_path() --- diff --git a/src/shared/install.c b/src/shared/install.c index 183da5865e0..0f18b1bb053 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -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;