diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-03-23 10:48:13 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-03-23 11:50:18 +0100 |
commit | 5980d463048f25411c55da2f6387cdc8eaeef4c8 (patch) | |
tree | e5c32417015bfd67d326d278b1cd7dac3ada39de /src/core/efi-random.c | |
parent | 5b391395822575533ab0fc93485fc5554d0da099 (diff) | |
download | systemd-5980d463048f25411c55da2f6387cdc8eaeef4c8.tar.gz |
strv: declare iterator of FOREACH_STRING() in the loop
Same idea as 03677889f0ef42cdc534bf3b31265a054b20a354.
No functional change intended. The type of the iterator is generally changed to
be 'const char*' instead of 'char*'. Despite the type commonly used, modifying
the string was not allowed.
I adjusted the naming of some short variables for clarity and reduced the scope
of some variable declarations in code that was being touched anyway.
Diffstat (limited to 'src/core/efi-random.c')
-rw-r--r-- | src/core/efi-random.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/core/efi-random.c b/src/core/efi-random.c index a0b89d1379..e8d8ccd117 100644 --- a/src/core/efi-random.c +++ b/src/core/efi-random.c @@ -20,24 +20,23 @@ * is suitably validated. */ static void lock_down_efi_variables(void) { - const char *p; int r; /* Paranoia: let's restrict access modes of these a bit, so that unprivileged users can't use them to * identify the system or gain too much insight into what we might have credited to the entropy * pool. */ - FOREACH_STRING(p, + FOREACH_STRING(path, EFIVAR_PATH(EFI_LOADER_VARIABLE(LoaderRandomSeed)), EFIVAR_PATH(EFI_LOADER_VARIABLE(LoaderSystemToken))) { - r = chattr_path(p, 0, FS_IMMUTABLE_FL, NULL); + r = chattr_path(path, 0, FS_IMMUTABLE_FL, NULL); if (r == -ENOENT) continue; if (r < 0) - log_warning_errno(r, "Failed to drop FS_IMMUTABLE_FL from %s, ignoring: %m", p); + log_warning_errno(r, "Failed to drop FS_IMMUTABLE_FL from %s, ignoring: %m", path); - if (chmod(p, 0600) < 0) - log_warning_errno(errno, "Failed to reduce access mode of %s, ignoring: %m", p); + if (chmod(path, 0600) < 0) + log_warning_errno(errno, "Failed to reduce access mode of %s, ignoring: %m", path); } } |