strv: declare iterator of FOREACH_STRING() in the loop
Same idea as 03677889f0.
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.
This commit is contained in:
@@ -24,7 +24,6 @@ int mac_apparmor_setup(void) {
|
||||
#if HAVE_APPARMOR
|
||||
_cleanup_(aa_policy_cache_unrefp) aa_policy_cache *policy_cache = NULL;
|
||||
_cleanup_(aa_features_unrefp) aa_features *features = NULL;
|
||||
const char *current_file;
|
||||
_cleanup_free_ char *current_profile = NULL, *cache_dir_path = NULL;
|
||||
int r;
|
||||
|
||||
|
||||
@@ -786,7 +786,6 @@ void cgroup_oomd_xattr_apply(Unit *u, const char *cgroup_path) {
|
||||
}
|
||||
|
||||
static void cgroup_xattr_apply(Unit *u) {
|
||||
const char *xn;
|
||||
bool b;
|
||||
|
||||
assert(u);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3043,7 +3043,6 @@ static int setup_credentials(
|
||||
uid_t uid) {
|
||||
|
||||
_cleanup_free_ char *p = NULL, *q = NULL;
|
||||
const char *i;
|
||||
int r;
|
||||
|
||||
assert(context);
|
||||
|
||||
@@ -99,8 +99,6 @@ static int timer_add_default_dependencies(Timer *t) {
|
||||
return r;
|
||||
|
||||
LIST_FOREACH(value, v, t->values) {
|
||||
const char *target;
|
||||
|
||||
if (v->base != TIMER_CALENDAR)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -4133,7 +4133,6 @@ int unit_patch_contexts(Unit *u) {
|
||||
|
||||
if ((ec->root_image || !LIST_IS_EMPTY(ec->mount_images)) &&
|
||||
(cc->device_policy != CGROUP_DEVICE_POLICY_AUTO || cc->device_allow)) {
|
||||
const char *p;
|
||||
|
||||
/* When RootImage= or MountImages= is specified, the following devices are touched. */
|
||||
FOREACH_STRING(p, "/dev/loop-control", "/dev/mapper/control") {
|
||||
|
||||
Reference in New Issue
Block a user