From 0efaa4843edb7eff62c09c9fa7174dbdf2f43da4 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 4 Mar 2021 17:21:22 +0900 Subject: [PATCH] install: use null_or_empty_path() --- src/shared/install.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/shared/install.c b/src/shared/install.c index 183da5865e..0f18b1bb05 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;