chattr-util: drop mostly unused 'previous' argument from chattr_path() and friends

This commit is contained in:
Yu Watanabe
2025-03-04 00:47:12 +09:00
parent 047a4111df
commit a997f3387f
18 changed files with 37 additions and 32 deletions
+8 -3
View File
@@ -238,7 +238,12 @@ int efi_set_variable(const char *variable, const void *value, size_t size) {
* to protect them for accidental removal and modification. We are not changing these variables
* accidentally however, hence let's unset the bit first. */
r = chattr_path(p, 0, FS_IMMUTABLE_FL, &saved_flags);
r = chattr_full(AT_FDCWD, p,
/* value = */ 0,
/* mask = */ FS_IMMUTABLE_FL,
/* ret_previous = */ &saved_flags,
/* ret_final = */ NULL,
/* flags = */ 0);
if (r < 0 && r != -ENOENT)
log_debug_errno(r, "Failed to drop FS_IMMUTABLE_FL flag from '%s', ignoring: %m", p);
@@ -285,9 +290,9 @@ finish:
/* Restore the original flags field, just in case */
if (fd < 0)
q = chattr_path(p, saved_flags, FS_IMMUTABLE_FL, NULL);
q = chattr_path(p, saved_flags, FS_IMMUTABLE_FL);
else
q = chattr_fd(fd, saved_flags, FS_IMMUTABLE_FL, NULL);
q = chattr_fd(fd, saved_flags, FS_IMMUTABLE_FL);
if (q < 0)
log_debug_errno(q, "Failed to restore FS_IMMUTABLE_FL on '%s', ignoring: %m", p);
}