chattr-util: drop mostly unused 'previous' argument from chattr_path() and friends
This commit is contained in:
@@ -41,14 +41,14 @@ typedef enum ChattrApplyFlags {
|
||||
} ChattrApplyFlags;
|
||||
|
||||
int chattr_full(int dir_fd, const char *path, unsigned value, unsigned mask, unsigned *ret_previous, unsigned *ret_final, ChattrApplyFlags flags);
|
||||
static inline int chattr_at(int dir_fd, const char *path, unsigned value, unsigned mask, unsigned *previous) {
|
||||
return chattr_full(dir_fd, path, value, mask, previous, NULL, 0);
|
||||
static inline int chattr_at(int dir_fd, const char *path, unsigned value, unsigned mask) {
|
||||
return chattr_full(dir_fd, path, value, mask, NULL, NULL, 0);
|
||||
}
|
||||
static inline int chattr_fd(int fd, unsigned value, unsigned mask, unsigned *previous) {
|
||||
return chattr_full(fd, NULL, value, mask, previous, NULL, 0);
|
||||
static inline int chattr_fd(int fd, unsigned value, unsigned mask) {
|
||||
return chattr_full(fd, NULL, value, mask, NULL, NULL, 0);
|
||||
}
|
||||
static inline int chattr_path(const char *path, unsigned value, unsigned mask, unsigned *previous) {
|
||||
return chattr_full(AT_FDCWD, path, value, mask, previous, NULL, 0);
|
||||
static inline int chattr_path(const char *path, unsigned value, unsigned mask) {
|
||||
return chattr_full(AT_FDCWD, path, value, mask, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
int read_attr_fd(int fd, unsigned *ret);
|
||||
|
||||
+8
-3
@@ -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);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1259,7 +1259,7 @@ int xopenat_full(int dir_fd, const char *path, int open_flags, XOpenFlags xopen_
|
||||
}
|
||||
|
||||
if (FLAGS_SET(xopen_flags, XO_NOCOW)) {
|
||||
r = chattr_fd(fd, FS_NOCOW_FL, FS_NOCOW_FL, NULL);
|
||||
r = chattr_fd(fd, FS_NOCOW_FL, FS_NOCOW_FL);
|
||||
if (r < 0 && !ERRNO_IS_NOT_SUPPORTED(r))
|
||||
goto error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user