various: correct laccess() error check

laccess is our own macro that uses RET_NERRNO.
This commit is contained in:
Mike Yuan
2024-10-04 21:26:04 +02:00
parent 598bb6fde4
commit 7c1dd9e288
10 changed files with 54 additions and 48 deletions
+3 -2
View File
@@ -97,8 +97,9 @@ int path_is_extension_tree(ImageClass image_class, const char *path, const char
/* Does the path exist at all? If not, generate an error immediately. This is useful so that a missing root dir
* always results in -ENOENT, and we can properly distinguish the case where the whole root doesn't exist from
* the case where just the os-release file is missing. */
if (laccess(path, F_OK) < 0)
return -errno;
r = laccess(path, F_OK);
if (r < 0)
return r;
/* We use /usr/lib/extension-release.d/extension-release[.NAME] as flag for something being a system extension,
* /etc/extension-release.d/extension-release[.NAME] as flag for something being a system configuration, and finally,
+5 -4
View File
@@ -904,6 +904,7 @@ char **env_generator_binary_paths(RuntimeScope runtime_scope) {
int find_portable_profile(const char *name, const char *unit, char **ret_path) {
const char *dot;
int r;
assert(name);
assert(ret_path);
@@ -917,13 +918,13 @@ int find_portable_profile(const char *name, const char *unit, char **ret_path) {
if (!joined)
return -ENOMEM;
if (laccess(joined, F_OK) >= 0) {
r = laccess(joined, F_OK);
if (r >= 0) {
*ret_path = TAKE_PTR(joined);
return 0;
}
if (errno != ENOENT)
return -errno;
if (r != -ENOENT)
return r;
}
return -ENOENT;