various: use _NEG_ macros to reduce indentation

No functional change intended.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2023-08-09 17:03:15 +02:00
parent 1f2db2e315
commit bb44fd0734
23 changed files with 188 additions and 255 deletions

View File

@@ -936,11 +936,10 @@ int path_is_root_at(int dir_fd, const char *path) {
int mntid;
r = path_get_mnt_id_at_fallback(dir_fd, "", &mntid);
if (r < 0) {
if (ERRNO_IS_NOT_SUPPORTED(r))
return true; /* skip the mount ID check */
if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
return true; /* skip the mount ID check */
if (r < 0)
return r;
}
assert(mntid >= 0);
st.nsx.stx_mnt_id = mntid;
@@ -951,11 +950,10 @@ int path_is_root_at(int dir_fd, const char *path) {
int mntid;
r = path_get_mnt_id_at_fallback(dir_fd, "..", &mntid);
if (r < 0) {
if (ERRNO_IS_NOT_SUPPORTED(r))
return true; /* skip the mount ID check */
if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
return true; /* skip the mount ID check */
if (r < 0)
return r;
}
assert(mntid >= 0);
pst.nsx.stx_mnt_id = mntid;

View File

@@ -94,14 +94,12 @@ static int extension_release_strict_xattr_value(int extension_release_fd, const
/* No xattr or cannot parse it? Then skip this. */
_cleanup_free_ char *extension_release_xattr = NULL;
r = fgetxattr_malloc(extension_release_fd, "user.extension-release.strict", &extension_release_xattr);
if (r < 0) {
if (!ERRNO_IS_XATTR_ABSENT(r))
return log_debug_errno(r,
"%s/%s: Failed to read 'user.extension-release.strict' extended attribute from file, ignoring: %m",
extension_release_dir_path, filename);
return log_debug_errno(r, "%s/%s does not have user.extension-release.strict xattr, ignoring.", extension_release_dir_path, filename);
}
if (ERRNO_IS_NEG_XATTR_ABSENT(r))
return log_debug_errno(r, "%s/%s does not have user.extension-release.strict xattr, ignoring.",
extension_release_dir_path, filename);
if (r < 0)
return log_debug_errno(r, "%s/%s: Failed to read 'user.extension-release.strict' extended attribute from file, ignoring: %m",
extension_release_dir_path, filename);
/* Explicitly set to request strict matching? Skip it. */
r = parse_boolean(extension_release_xattr);

View File

@@ -118,12 +118,10 @@ int is_pressure_supported(void) {
FOREACH_STRING(p, "/proc/pressure/cpu", "/proc/pressure/io", "/proc/pressure/memory") {
r = read_virtual_file(p, 0, NULL, NULL);
if (r < 0) {
if (r == -ENOENT || ERRNO_IS_NOT_SUPPORTED(r))
return (cached = false);
if (r == -ENOENT || ERRNO_IS_NEG_NOT_SUPPORTED(r))
return (cached = false);
if (r < 0)
return r;
}
}
return (cached = true);