}
static int open_sockets(int *epoll_fd, bool accept) {
- char **address;
int n, fd, r, count = 0;
n = sd_listen_fds(true);
static int exec_process(const char *name, char **argv, int start_fd, size_t n_fds) {
_cleanup_strv_free_ char **envp = NULL;
const char *var;
- char **s;
int r;
if (arg_inetd && n_fds != 1)
case ARG_FDNAME: {
_cleanup_strv_free_ char **names = NULL;
- char **s;
names = strv_split(optarg, ":");
if (!names)
int verb_calendar(int argc, char *argv[], void *userdata) {
int ret = 0, r;
- char **p;
usec_t n;
if (arg_base_time != USEC_INFINITY)
#include "strv.h"
int verb_cat_config(int argc, char *argv[], void *userdata) {
- char **arg, **list;
+ char **list;
int r;
pager_open(arg_pager_flags);
if (r < 0)
return r;
} else {
- char **line;
-
r = unit_new_for_name(m, sizeof(Service), "test.service", &u);
if (r < 0)
return log_error_errno(r, "Failed to create test.service: %m");
static int list_dependencies_one(sd_bus *bus, const char *name, unsigned level, char ***units, unsigned branches) {
_cleanup_strv_free_ char **deps = NULL;
- char **c;
int r;
usec_t service_longest = 0;
int to_print = 0;
puts("The time when unit became active or started is printed after the \"@\" character.\n"
"The time the unit took to start is printed after the \"+\" character.\n");
- if (argc > 1) {
- char **name;
+ if (argc > 1)
STRV_FOREACH(name, strv_skip(argv, 1))
list_dependencies(bus, *name);
- } else
+ else
list_dependencies(bus, SPECIAL_DEFAULT_TARGET);
h = hashmap_free(h);
char *to_patterns[]) {
_cleanup_strv_free_ char **units = NULL;
- char **unit;
- int r;
bool match_patterns;
+ int r;
assert(u);
assert(prop);
static int expand_patterns(sd_bus *bus, char **patterns, char ***ret) {
_cleanup_strv_free_ char **expanded_patterns = NULL;
- char **pattern;
int r;
STRV_FOREACH(pattern, patterns) {
if (!set_isempty(known)) {
_cleanup_free_ char **l = NULL;
- char **filesystem;
printf("\n"
"# %sUngrouped filesystems%s (known but not included in any of the groups except @known):\n",
log_notice_errno(k, "# Not showing unlisted filesystems, couldn't retrieve kernel filesystem list: %m");
} else if (!set_isempty(kernel)) {
_cleanup_free_ char **l = NULL;
- char **filesystem;
printf("\n"
"# %sUnlisted filesystems%s (available to the local kernel, but not included in any of the groups listed above):\n",
STRV_FOREACH(filesystem, l)
printf("# %s\n", *filesystem);
}
- } else {
- char **name;
-
+ } else
STRV_FOREACH(name, strv_skip(argv, 1)) {
const FilesystemSet *set;
dump_filesystem_set(set);
first = false;
}
- }
return 0;
}
#include "strv.h"
static int analyze_elf(char **filenames, JsonFormatFlags json_flags) {
- char **filename;
int r;
STRV_FOREACH(filename, filenames) {
_cleanup_free_ char *var = NULL;
int r, k;
size_t count = 0;
- char **filename;
if (strv_isempty(filenames))
return 0;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
_cleanup_strv_free_ char **list = NULL;
size_t n = 0;
- char **i;
r = sd_bus_call_method(
bus,
ret = r;
}
- } else {
- char **i;
-
+ } else
STRV_FOREACH(i, units) {
_cleanup_free_ char *mangled = NULL, *instance = NULL;
const char *name;
if (r < 0 && ret >= 0)
ret = r;
}
- }
if (overview_table) {
if (!FLAGS_SET(flags, ANALYZE_SECURITY_SHORT)) {
if (!set_isempty(known)) {
_cleanup_free_ char **l = NULL;
- char **syscall;
printf("\n"
"# %sUngrouped System Calls%s (known but not included in any of the groups except @known):\n",
log_notice_errno(k, "# Not showing unlisted system calls, couldn't retrieve kernel system call list: %m");
} else if (!set_isempty(kernel)) {
_cleanup_free_ char **l = NULL;
- char **syscall;
printf("\n"
"# %sUnlisted System Calls%s (supported by the local kernel, but not included in any of the groups listed above):\n",
STRV_FOREACH(syscall, l)
printf("# %s\n", *syscall);
}
- } else {
- char **name;
-
+ } else
STRV_FOREACH(name, strv_skip(argv, 1)) {
const SyscallFilterSet *set;
dump_syscall_filter(set);
first = false;
}
- }
return 0;
}
#include "terminal-util.h"
int verb_timespan(int argc, char *argv[], void *userdata) {
- char **input_timespan;
-
STRV_FOREACH(input_timespan, strv_skip(argv, 1)) {
_cleanup_(table_unrefp) Table *table = NULL;
usec_t output_usecs;
int verb_timestamp(int argc, char *argv[], void *userdata) {
int ret = 0, r;
- char **p;
STRV_FOREACH(p, strv_skip(argv, 1)) {
r = test_timestamp_one(*p);
#include "strv.h"
static bool strv_fnmatch_strv_or_empty(char* const* patterns, char **strv, int flags) {
- char **s;
-
STRV_FOREACH(s, strv)
if (strv_fnmatch_or_empty(patterns, *s, flags))
return true;
int verb_unit_paths(int argc, char *argv[], void *userdata) {
_cleanup_(lookup_paths_free) LookupPaths paths = {};
int r;
- char **p;
r = lookup_paths_init(&paths, arg_scope, 0, NULL);
if (r < 0)
}
int verify_generate_path(char **var, char **filenames) {
- const char *old;
- char **filename;
-
_cleanup_strv_free_ char **ans = NULL;
+ const char *old;
int r;
STRV_FOREACH(filename, filenames) {
}
static int verify_documentation(Unit *u, bool check_man) {
- char **p;
int r = 0, k;
STRV_FOREACH(p, u->documentation) {
Unit *units[strv_length(filenames)];
_cleanup_free_ char *var = NULL;
int r, k, i, count = 0;
- char **filename;
if (strv_isempty(filenames))
return 0;
static int process_aliases(char *argv[], char *tempdir, char ***ret) {
_cleanup_strv_free_ char **filenames = NULL;
- char **filename;
int r;
assert(argv);
static int run(int argc, char *argv[]) {
_cleanup_strv_free_erase_ char **l = NULL;
usec_t timeout;
- char **p;
int r;
log_show_color(true);
_cleanup_hashmap_free_ Hashmap *fh = NULL;
_cleanup_set_free_free_ Set *masked = NULL;
- char **files, **p;
+ char **files;
int r;
assert(ret);
int c;
c = base_cmp((char* const*) *strv + i, (char* const*) &path);
- if (c == 0) {
- char **dir;
-
+ if (c == 0)
/* Oh, there already is an entry with a matching name (the last component). */
-
STRV_FOREACH(dir, dirs) {
_cleanup_free_ char *rdir = NULL;
char *p1, *p2;
}
}
- } else if (c > 0)
+ else if (c > 0)
/* Following files have lower priority, let's go insert our
* new entry. */
break;
int write_env_file(const char *fname, char **l) {
_cleanup_fclose_ FILE *f = NULL;
_cleanup_free_ char *p = NULL;
- char **i;
int r;
assert(fname);
}
bool strv_env_is_valid(char **e) {
- char **p, **q;
-
STRV_FOREACH(p, e) {
size_t k;
}
bool strv_env_name_is_valid(char **l) {
- char **p;
-
STRV_FOREACH(p, l) {
if (!env_name_is_valid(*p))
return false;
}
bool strv_env_name_or_assignment_is_valid(char **l) {
- char **p;
-
STRV_FOREACH(p, l) {
if (!env_assignment_is_valid(*p) && !env_name_is_valid(*p))
return false;
char **strv_env_delete(char **x, size_t n_lists, ...) {
size_t n, i = 0;
- char **k, **r;
+ char **r;
va_list ap;
/* Deletes every entry from x that is mentioned in the other
STRV_FOREACH(k, x) {
va_start(ap, n_lists);
for (size_t v = 0; v < n_lists; v++) {
- char **l, **j;
+ char **l;
l = va_arg(ap, char**);
STRV_FOREACH(j, l)
int strv_env_replace_consume(char ***l, char *p) {
const char *t, *name;
- char **f;
int r;
assert(p);
}
char *strv_env_get_n(char **l, const char *name, size_t k, unsigned flags) {
- char **i;
-
assert(name);
if (k <= 0)
}
char *strv_env_pairs_get(char **l, const char *name) {
- char **key, **value, *result = NULL;
+ char *result = NULL;
assert(name);
}
char **strv_env_clean_with_callback(char **e, void (*invalid_callback)(const char *p, void *userdata), void *userdata) {
- char **p, **q;
int k = 0;
STRV_FOREACH(p, e) {
}
char **replace_env_argv(char **argv, char **env) {
- char **ret, **i;
+ char **ret;
size_t k = 0, l = 0;
l = strv_length(argv);
int getenv_path_list(const char *name, char ***ret_paths) {
_cleanup_strv_free_ char **l = NULL;
const char *e;
- char **p;
int r;
assert(name);
assert(argv);
- char **a;
STRV_FOREACH(a, argv) {
_cleanup_free_ char *t = NULL;
FILE **ret,
char **ret_path) {
- char **i;
-
assert(path);
assert(mode);
assert(ret);
int _set_put_strdupv_full(Set **s, const struct hash_ops *hash_ops, char **l HASHMAP_DEBUG_PARAMS) {
int n = 0, r;
- char **i;
assert(s);
int _ordered_set_put_strdupv(OrderedSet **s, char **l HASHMAP_DEBUG_PARAMS) {
int n = 0, r;
- char **i;
STRV_FOREACH(i, l) {
r = _ordered_set_put_strdup(s, *i HASHMAP_DEBUG_PASS_ARGS);
int load_os_release_pairs_with_prefix(const char *root, const char *prefix, char ***ret) {
_cleanup_strv_free_ char **os_release_pairs = NULL, **os_release_pairs_prefixed = NULL;
- char **p, **q;
int r;
r = load_os_release_pairs(root, &os_release_pairs);
}
static int patch_root_prefix_strv(char **l, const char *root_dir) {
- char **i;
int r;
if (!root_dir)
}
char* path_startswith_strv(const char *p, char **set) {
- char **s, *t;
-
STRV_FOREACH(s, set) {
+ char *t;
+
t = path_startswith(p, *s);
if (t)
return t;
}
int path_strv_make_absolute_cwd(char **l) {
- char **s;
int r;
/* Goes through every item in the string list and makes it
}
char **path_strv_resolve(char **l, const char *root) {
- char **s;
unsigned k = 0;
bool enomem = false;
int r;
p = DEFAULT_PATH;
if (exec_search_path) {
- char **element;
-
STRV_FOREACH(element, exec_search_path) {
_cleanup_free_ char *full_path = NULL;
+
if (!path_is_absolute(*element))
continue;
+
full_path = path_join(*element, name);
if (!full_path)
return -ENOMEM;
bool paths_check_timestamp(const char* const* paths, usec_t *timestamp, bool update) {
bool changed = false, originally_unset;
- const char* const* i;
assert(timestamp);
_cleanup_strv_free_ char **names = NULL;
_cleanup_free_ char *path = NULL;
- char *c, **name;
+ char *c;
path = path_join(root, pattern);
if (!path)
}
bool path_strv_contains(char **l, const char *path) {
- char **i;
-
STRV_FOREACH(i, l)
if (path_equal(*i, path))
return true;
}
bool prefixed_path_strv_contains(char **l, const char *path) {
- char **i, *j;
-
STRV_FOREACH(i, l) {
- j = *i;
+ const char *j = *i;
+
if (*j == '-')
j++;
if (*j == '+')
assert(!(flags & PROCESS_CMDLINE_USE_LOCALE));
_cleanup_strv_free_ char **args = NULL;
- char **p;
args = strv_parse_nulstr(t, k);
if (!args)
#include "strv.h"
char* strv_find(char * const *l, const char *name) {
- char * const *i;
-
assert(name);
STRV_FOREACH(i, l)
}
char* strv_find_case(char * const *l, const char *name) {
- char * const *i;
-
assert(name);
STRV_FOREACH(i, l)
}
char* strv_find_prefix(char * const *l, const char *name) {
- char * const *i;
-
assert(name);
STRV_FOREACH(i, l)
}
char* strv_find_startswith(char * const *l, const char *name) {
- char * const *i, *e;
-
assert(name);
/* Like strv_find_prefix, but actually returns only the
* suffix, not the whole item */
STRV_FOREACH(i, l) {
+ char *e;
+
e = startswith(*i, name);
if (e)
return e;
}
char** strv_free(char **l) {
- char **k;
-
STRV_FOREACH(k, l)
free(*k);
}
char** strv_free_erase(char **l) {
- char **i;
-
STRV_FOREACH(i, l)
erase_and_freep(i);
char** strv_copy(char * const *l) {
_cleanup_strv_free_ char **result = NULL;
- char **k, * const *i;
+ char **k;
result = new(char*, strv_length(l) + 1);
if (!result)
}
size_t strv_length(char * const *l) {
- char * const *i;
size_t n = 0;
STRV_FOREACH(i, l)
}
int strv_extend_strv(char ***a, char * const *b, bool filter_duplicates) {
- char * const *s, **t;
size_t p, q, i = 0;
+ char **t;
assert(a);
}
int strv_extend_strv_concat(char ***a, char * const *b, const char *suffix) {
- char * const *s;
int r;
STRV_FOREACH(s, b) {
}
char* strv_join_full(char * const *l, const char *separator, const char *prefix, bool unescape_separators) {
- char * const *s;
char *r, *e;
size_t n, k, m;
}
char** strv_uniq(char **l) {
- char **i;
-
/* Drops duplicate entries. The first identical string will be
* kept, the others dropped */
}
bool strv_is_uniq(char * const *l) {
- char * const *i;
-
STRV_FOREACH(i, l)
if (strv_contains(i+1, *i))
return false;
*/
_cleanup_free_ char *m = NULL;
- char * const *i;
size_t n = 0;
assert(ret);
}
bool strv_overlap(char * const *a, char * const *b) {
- char * const *i;
-
STRV_FOREACH(i, a)
if (strv_contains(b, *i))
return true;
}
void strv_print(char * const *l) {
- char * const *s;
-
STRV_FOREACH(s, l)
puts(*s);
}
}
char** strv_shell_escape(char **l, const char *bad) {
- char **s;
-
/* Escapes every character in every string in l that is in bad,
* edits in-place, does not roll-back on error. */
int fputstrv(FILE *f, char * const *l, const char *separator, bool *space) {
bool b = false;
- char * const *s;
int r;
/* Like fputs(), but for strv, and with a less stupid argument order */
bool strv_overlap(char * const *a, char * const *b) _pure_;
+#define _STRV_FOREACH(s, l, i) \
+ for (typeof(*(l)) *s, *i = (l); (s = i) && *i; i++)
+
#define STRV_FOREACH(s, l) \
- for ((s) = (l); (s) && *(s); (s)++)
+ _STRV_FOREACH(s, l, UNIQ_T(i, UNIQ))
+
+#define _STRV_FOREACH_BACKWARDS(s, l, h, i) \
+ for (typeof(*(l)) *s, *h = (l), *i = ({ \
+ size_t _len = strv_length(h); \
+ _len > 0 ? h + _len - 1 : NULL; \
+ }); \
+ i && (s = i) >= h; \
+ i--)
+
+#define STRV_FOREACH_BACKWARDS(s, l) \
+ _STRV_FOREACH_BACKWARDS(s, l, UNIQ_T(h, UNIQ), UNIQ_T(i, UNIQ))
-#define STRV_FOREACH_BACKWARDS(s, l) \
- for (s = ({ \
- typeof(l) _l = l; \
- _l ? _l + strv_length(_l) - 1U : NULL; \
- }); \
- (l) && ((s) >= (l)); \
- (s)--)
+#define _STRV_FOREACH_PAIR(x, y, l, i) \
+ for (typeof(*l) *x, *y, *i = (l); \
+ i && *(x = i) && *(y = i + 1); \
+ i += 2)
-#define STRV_FOREACH_PAIR(x, y, l) \
- for ((x) = (l), (y) = (x) ? (x+1) : NULL; (x) && *(x) && *(y); (x) += 2, (y) = (x + 1))
+#define STRV_FOREACH_PAIR(x, y, l) \
+ _STRV_FOREACH_PAIR(x, y, l, UNIQ_T(i, UNIQ))
char** strv_sort(char **l);
void strv_print(char * const *l);
#define STARTSWITH_SET(p, ...) \
({ \
const char *_p = (p); \
- char *_found = NULL, **_i; \
+ char *_found = NULL; \
STRV_FOREACH(_i, STRV_MAKE(__VA_ARGS__)) { \
_found = startswith(_p, *_i); \
if (_found) \
#define ENDSWITH_SET(p, ...) \
({ \
const char *_p = (p); \
- char *_found = NULL, **_i; \
+ char *_found = NULL; \
STRV_FOREACH(_i, STRV_MAKE(__VA_ARGS__)) { \
_found = endswith(_p, *_i); \
if (_found) \
siphash24_init(&state, HASH_KEY.bytes);
- char **dir;
- STRV_FOREACH(dir, (char**) lp->search_path) {
+ STRV_FOREACH(dir, lp->search_path) {
struct stat st;
if (lookup_paths_mtime_exclude(lp, *dir))
_cleanup_hashmap_free_ Hashmap *ids = NULL, *names = NULL;
_cleanup_set_free_free_ Set *paths = NULL;
uint64_t timestamp_hash;
- char **dir;
int r;
/* Before doing anything, check if the timestamp hash that was passed is still valid.
return log_oom();
}
- STRV_FOREACH(dir, (char**) lp->search_path) {
+ STRV_FOREACH(dir, lp->search_path) {
_cleanup_closedir_ DIR *d = NULL;
d = opendir(*dir);
Set **names,
const char *name) {
- char **aliases, **alias;
+ char **aliases;
int r;
assert(name_type == UNIT_NAME_PLAIN || instance);
}
else {
_cleanup_strv_free_ char **files = NULL;
- char **f;
r = conf_files_list_strv(&files, ".conf", NULL, 0, (const char**) CONF_PATHS_STRV("binfmt.d"));
if (r < 0)
static int verb_status(int argc, char *argv[], void *userdata) {
_cleanup_free_ char *path = NULL, *prefix = NULL, *suffix = NULL, *good = NULL, *bad = NULL;
uint64_t left, done;
- char **p;
int r;
r = acquire_boot_count_path(&path, &prefix, &left, &done, &suffix);
_cleanup_free_ char *path = NULL, *prefix = NULL, *suffix = NULL, *good = NULL, *bad = NULL, *parent = NULL;
const char *target, *source1, *source2;
uint64_t done;
- char **p;
int r;
r = acquire_boot_count_path(&path, &prefix, NULL, &done, &suffix);
if (e->kernel)
boot_entry_file_list("linux", e->root, e->kernel, &status);
- char **s;
STRV_FOREACH(s, e->initrd)
boot_entry_file_list(s == e->initrd ? "initrd" : NULL,
e->root,
};
static int create_subdirs(const char *root, const char * const *subdirs) {
- const char *const *i;
int r;
STRV_FOREACH(i, subdirs) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_hashmap_free_ Hashmap *names = NULL;
_cleanup_(table_unrefp) Table *table = NULL;
- char **i, *k;
+ char *k;
void *v;
int r;
static int tree(int argc, char **argv, void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
- char **i;
int r;
/* Do superficial verification of arguments before even opening the bus */
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *message = NULL;
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
- char **i;
uint32_t flags = 0;
const char *unique_name;
bool is_monitor = false;
static int get_property(int argc, char **argv, void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
- char **i;
int r;
r = acquire_bus(false, &bus);
if (arg_names) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_free_ char *root = NULL;
- char **name;
STRV_FOREACH(name, arg_names) {
int q;
}
static int load_bpf_progs_from_fs_to_set(Unit *u, char **filter_paths, Set **set) {
- char **bpf_fs_path;
-
set_clear(*set);
STRV_FOREACH(bpf_fs_path, filter_paths) {
_cleanup_free_ char *disable_controllers_str = NULL, *cpuset_cpus = NULL, *cpuset_mems = NULL, *startup_cpuset_cpus = NULL, *startup_cpuset_mems = NULL;
CGroupContext *c;
struct in_addr_prefix *iaai;
- char **path;
char cda[FORMAT_CGROUP_DIFF_MAX];
char cdb[FORMAT_CGROUP_DIFF_MAX];
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
_cleanup_free_ char *buf = NULL;
_cleanup_fclose_ FILE *f = NULL;
- char **entry;
size_t size = 0;
if (n == 0)
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
_cleanup_free_ char *joined = NULL;
- char **s;
if (strv_isempty(l)) {
c->restrict_network_interfaces_is_allow_list = false;
sd_bus_error *error) {
ExecContext *c = userdata;
- char **j;
int r;
assert(bus);
if (r < 0)
return r;
- for (size_t i = 0; i < d->n_items; i++) {
- char **dst;
-
+ for (size_t i = 0; i < d->n_items; i++)
STRV_FOREACH(dst, d->items[i].symlinks) {
r = sd_bus_message_append(reply, "(sst)", d->items[i].path, *dst, 0 /* flags, unused for now */);
if (r < 0)
return r;
}
- }
return sd_bus_message_close_container(reply);
}
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
_cleanup_free_ char *joined = NULL;
FilesystemParseFlags invert_flag = allow_list ? 0 : FILESYSTEM_PARSE_INVERT;
- char **s;
if (strv_isempty(l)) {
c->restrict_filesystems_allow_list = false;
if (streq(name, "SupplementaryGroups")) {
_cleanup_strv_free_ char **l = NULL;
- char **p;
r = sd_bus_message_read_strv(message, &l);
if (r < 0)
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
_cleanup_free_ char *joined = NULL;
SeccompParseFlags invert_flag = allow_list ? 0 : SECCOMP_PARSE_INVERT;
- char **s;
if (strv_isempty(l)) {
c->syscall_allow_list = false;
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
_cleanup_free_ char *joined = NULL;
SeccompParseFlags invert_flag = allow_list ? 0 : SECCOMP_PARSE_INVERT;
- char **s;
if (strv_isempty(l)) {
c->syscall_log_allow_list = false;
if (strv_isempty(l))
c->syscall_archs = set_free(c->syscall_archs);
- else {
- char **s;
-
+ else
STRV_FOREACH(s, l) {
uint32_t a;
return r;
}
- }
-
joined = strv_join(l, " ");
if (!joined)
return -ENOMEM;
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
_cleanup_free_ char *joined = NULL;
- char **s;
if (strv_isempty(l)) {
c->address_families_allow_list = allow_list;
_cleanup_fclose_ FILE *f = NULL;
_cleanup_strv_free_ char **l = NULL;
size_t size = 0;
- char **i;
r = sd_bus_message_enter_container(message, 'a', "(sb)");
if (r < 0)
"ExtensionDirectories")) {
_cleanup_strv_free_ char **l = NULL;
char ***dirs;
- char **p;
r = sd_bus_message_read_strv(message, &l);
if (r < 0)
} else if (streq(name, "ExecSearchPath")) {
_cleanup_strv_free_ char **l = NULL;
- char **p;
r = sd_bus_message_read_strv(message, &l);
if (r < 0)
return r;
- STRV_FOREACH(p, l) {
+ STRV_FOREACH(p, l)
if (!path_is_absolute(*p) || !path_is_normalized(*p) || strchr(*p, ':'))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid %s", name);
- }
+
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
if (strv_isempty(l)) {
c->exec_search_path = strv_free(c->exec_search_path);
} else if (STR_IN_SET(name, "RuntimeDirectory", "StateDirectory", "CacheDirectory", "LogsDirectory", "ConfigurationDirectory")) {
_cleanup_strv_free_ char **l = NULL;
- char **p;
r = sd_bus_message_read_strv(message, &l);
if (r < 0)
unit_write_settingf(u, flags, name, "%s=", name);
} else {
_cleanup_free_ char *joined = NULL;
- char **source;
STRV_FOREACH(source, l) {
r = exec_directory_add(&d->items, &d->n_items, *source, NULL);
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
Manager *m = userdata;
int r;
- char **unit;
_cleanup_strv_free_ char **units = NULL;
assert(message);
if (streq(name, "Symlinks")) {
_cleanup_strv_free_ char **l = NULL;
- char **p;
r = sd_bus_message_read_strv(message, &l);
if (r < 0)
return r;
- STRV_FOREACH(p, l) {
+ STRV_FOREACH(p, l)
if (!path_is_absolute(*p))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Symlink path is not absolute: %s", *p);
- }
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
if (strv_isempty(l)) {
if (streq(name, "Documentation")) {
_cleanup_strv_free_ char **l = NULL;
- char **p;
r = sd_bus_message_read_strv(message, &l);
if (r < 0)
return r;
- STRV_FOREACH(p, l) {
+ STRV_FOREACH(p, l)
if (!documentation_url_is_valid(*p))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid URL in %s: %s", name, *p);
- }
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
if (strv_isempty(l)) {
} else if (streq(name, "RequiresMountsFor")) {
_cleanup_strv_free_ char **l = NULL;
- char **p;
r = sd_bus_message_read_strv(message, &l);
if (r < 0)
prefix, strna(d->sysfs),
prefix, strna(s));
- if (!strv_isempty(d->wants_property)) {
- char **i;
-
- STRV_FOREACH(i, d->wants_property)
- fprintf(f, "%sudev SYSTEMD_WANTS: %s\n",
- prefix, *i);
- }
+ STRV_FOREACH(i, d->wants_property)
+ fprintf(f, "%sudev SYSTEMD_WANTS: %s\n",
+ prefix, *i);
}
_pure_ static UnitActiveState device_active_state(Unit *u) {
k = NULL;
}
- if (d->state != DEVICE_DEAD) {
- char **i;
-
+ if (d->state != DEVICE_DEAD)
/* So here's a special hack, to compensate for the fact that the udev database's reload cycles are not
* synchronized with our own reload cycles: when we detect that the SYSTEMD_WANTS property of a device
* changes while the device unit is already up, let's manually trigger any new units listed in it not
*
* We do this only if the device has been up already when we parse this, as otherwise the usual
* dependency logic that is run from the dead → plugged transition will trigger these deps. */
-
STRV_FOREACH(i, added) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
if (r < 0)
log_unit_warning_errno(u, r, "Failed to enqueue SYSTEMD_WANTS= job, ignoring: %s", bus_error_message(&error, r));
}
- }
return strv_free_and_replace(d->wants_property, added);
}
static int get_supplementary_groups(const ExecContext *c, const char *user,
const char *group, gid_t gid,
gid_t **supplementary_gids, int *ngids) {
- char **i;
int r, k = 0;
int ngroups_max;
bool keep_groups = false;
pam_handle_t *handle = NULL;
sigset_t old_ss;
int pam_code = PAM_SUCCESS, r;
- char **nv;
bool close_session = false;
pid_t pam_pid = 0, parent_pid;
int flags = 0;
static int build_pass_environment(const ExecContext *c, char ***ret) {
_cleanup_strv_free_ char **pass_env = NULL;
size_t n_env = 0;
- char **i;
STRV_FOREACH(i, c->pass_environment) {
_cleanup_free_ char *x = NULL;
static int create_many_symlinks(const char *root, const char *source, char **symlinks) {
_cleanup_free_ char *src_abs = NULL;
- char **dst;
int r;
assert(source);
for (ExecDirectoryType dt = 0; dt < _EXEC_DIRECTORY_TYPE_MAX; dt++) {
for (size_t i = 0; i < context->directories[dt].n_items; i++) {
_cleanup_free_ char *private_path = NULL, *path = NULL;
- char **symlink;
STRV_FOREACH(symlink, context->directories[dt].items[i].symlinks) {
_cleanup_free_ char *src_abs = NULL, *dst_abs = NULL;
* service next. */
(void) rm_rf(p, REMOVE_ROOT);
- char **symlink;
STRV_FOREACH(symlink, c->directories[EXEC_DIRECTORY_RUNTIME].items[i].symlinks) {
_cleanup_free_ char *symlink_abs = NULL;
static int exec_context_load_environment(const Unit *unit, const ExecContext *c, char ***ret) {
_cleanup_strv_free_ char **v = NULL;
- char **i;
int r;
assert(c);
}
static void strv_fprintf(FILE *f, char **l) {
- char **g;
-
assert(f);
STRV_FOREACH(g, l)
}
void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
- char **e, **d;
int r;
assert(c);
return r;
}
- char **symlink;
STRV_FOREACH(symlink, c->directories[t].items[i].symlinks) {
j = path_join(prefix[t], *symlink);
if (!j)
static int process_deps(Unit *u, UnitDependency dependency, const char *dir_suffix) {
_cleanup_strv_free_ char **paths = NULL;
- char **p;
int r;
r = unit_file_find_dropin_paths(NULL,
int unit_load_dropin(Unit *u) {
_cleanup_strv_free_ char **l = NULL;
- char **f;
int r;
assert(u);
_cleanup_(mount_options_free_allp) MountOptions *options = NULL;
_cleanup_strv_free_ char **l = NULL;
- char **first = NULL, **second = NULL;
ExecContext *c = data;
const Unit *u = userdata;
int r;
}
static void setenv_manager_environment(void) {
- char **p;
int r;
STRV_FOREACH(p, arg_manager_environment) {
}
static bool generator_path_any(const char* const* paths) {
- char **path;
bool found = false;
/* Optimize by skipping the whole process by not creating output directories
}
static int append_access_mounts(MountEntry **p, char **strv, MountMode mode, bool forcibly_require_prefix) {
- char **i;
-
assert(p);
/* Adds a list of user-supplied READWRITE/READWRITE_IMPLICIT/READONLY/INACCESSIBLE entries */
}
static int append_empty_dir_mounts(MountEntry **p, char **strv) {
- char **i;
-
assert(p);
/* Adds tmpfs mounts to provide readable but empty directories. This is primarily used to implement the
char **extension_directories) {
_cleanup_strv_free_ char **overlays = NULL;
- char **hierarchy, **extension_directory;
int r;
if (n == 0 && strv_isempty(extension_directories))
}
static int create_symlinks_from_tuples(const char *root, char **strv_symlinks) {
- char **src, **dst;
int r;
STRV_FOREACH_PAIR(src, dst, strv_symlinks) {
ServiceExecCommand id;
size_t length = 0;
unsigned idx;
- char **arg;
assert(s);
assert(f);
Service *s = SERVICE(u);
bool notify_dbus = false;
const char *e;
- char * const *i;
int r;
assert(u);
fprintf(f, "%sSocketProtocol: %s\n", prefix, str);
if (!strv_isempty(s->symlinks)) {
- char **q;
-
fprintf(f, "%sSymlinks:", prefix);
STRV_FOREACH(q, s->symlinks)
fprintf(f, " %s", *q);
}
static void socket_close_fds(Socket *s) {
- char **i;
-
assert(s);
LIST_FOREACH(port, p, s->ports) {
static int socket_symlink(Socket *s) {
const char *p;
- char **i;
int r;
assert(s);
}
static char* merge_unit_ids(const char* unit_log_field, char **pairs) {
- char **unit_id, **job_type, *ans = NULL;
+ char *ans = NULL;
size_t size = 0, next;
STRV_FOREACH_PAIR(unit_id, job_type, pairs) {
if (j->generation == generation) {
Job *k, *delete = NULL;
_cleanup_free_ char **array = NULL, *unit_ids = NULL;
- char **unit_id, **job_type;
/* If the marker is NULL we have been here already and decided the job was loop-free from
* here. Hence shortcut things and return right-away. */
}
void unit_dump(Unit *u, FILE *f, const char *prefix) {
- char *t, **j;
+ char *t;
const char *prefix2;
Unit *following;
_cleanup_set_free_ Set *following_set = NULL;
}
static void unit_remove_transient(Unit *u) {
- char **i;
-
assert(u);
if (!u->transient)
int unit_coldplug(Unit *u) {
int r = 0, q;
- char **i;
assert(u);
bool unit_need_daemon_reload(Unit *u) {
_cleanup_strv_free_ char **t = NULL;
- char **path;
assert(u);
char* unit_concat_strv(char **l, UnitWriteFlags flags) {
_cleanup_free_ char *result = NULL;
size_t n = 0;
- char **i;
/* Takes a list of strings, escapes them, and concatenates them. This may be used to format command lines in a
* way suitable for ExecStart= stanzas */
return r;
if (r == 0) {
int ret = EXIT_SUCCESS;
- char **i;
STRV_FOREACH(i, paths) {
r = rm_rf(*i, REMOVE_ROOT|REMOVE_PHYSICAL|REMOVE_MISSING_OK);
}
static int add_matches(sd_journal *j, char **matches) {
- char **match;
int r;
r = sd_journal_add_match(j, "MESSAGE_ID=" SD_MESSAGE_COREDUMP_STR, 0);
static int verb_cat(int argc, char **argv, void *userdata) {
_cleanup_(closedirp) DIR *d = NULL;
int r, ret = 0;
- char **cn;
r = open_credential_directory(&d);
if (r == -ENXIO)
for (;;) {
_cleanup_strv_free_erase_ char **passwords = NULL;
- char **p;
if (--i == 0)
return log_error_errno(SYNTHETIC_ERRNO(ENOKEY),
void **ret_key,
size_t *ret_key_size) {
- char **i;
int r;
assert(key_file);
_cleanup_free_ char *friendly = NULL, *text = NULL, *disk_path = NULL;
_cleanup_strv_free_erase_ char **passwords = NULL;
- char **p, *id;
+ char *id;
int r = 0;
AskPasswordFlags flags = arg_ask_password_flags | ASK_PASSWORD_PUSH_CACHE;
#if HAVE_LIBCRYPTSETUP_PLUGINS
AskPasswordFlags flags = ASK_PASSWORD_PUSH_CACHE | ASK_PASSWORD_ACCEPT_CACHED;
_cleanup_strv_free_erase_ char **pins = NULL;
- char **p;
int r;
r = crypt_activate_by_token_pin(cd, name, "systemd-fido2", CRYPT_ANY_TOKEN, NULL, 0, usrptr, activation_flags);
uint32_t flags,
bool pass_volume_key) {
- char **p;
int r;
assert(cd);
}
static int generate_mask_symlinks(void) {
- char **u;
int r = 0;
if (strv_isempty(arg_mask))
}
static int generate_wants_symlinks(void) {
- char **u;
int r = 0;
if (strv_isempty(arg_wants))
_cleanup_free_ char *unit = NULL;
_cleanup_free_ char *path = NULL;
_cleanup_strv_free_ char **list = NULL;
- char **file;
char *c;
int r;
_cleanup_closedir_ DIR *d = NULL;
_cleanup_strv_free_ char **files = NULL, **dirs = NULL;
size_t n_files = 0, n_dirs = 0;
- char **t;
int r;
assert(top);
static int strv_pair_to_json(char **l, JsonVariant **ret) {
_cleanup_strv_free_ char **jl = NULL;
- char **a, **b;
STRV_FOREACH_PAIR(a, b, l) {
char *j;
}
static void strv_pair_print(char **l, const char *prefix) {
- char **p, **q;
-
assert(prefix);
STRV_FOREACH_PAIR(p, q, l) {
static int load_and_print(void) {
_cleanup_strv_free_ char **dirs = NULL, **files = NULL, **env = NULL;
- char **i;
int r;
r = environment_dirs(&dirs);
}
static int run(int argc, char *argv[]) {
- char **i;
int r;
log_setup();
_cleanup_strv_free_ char **names = NULL, **units = NULL;
_cleanup_free_ char *res = NULL;
- char **s;
int r;
assert(f);
if (r < 0)
return r;
} else {
- char **s;
-
STRV_FOREACH(s, wanted_by) {
r = generator_add_symlink(dest, *s, "wants", name);
if (r < 0)
static int activate_home(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r, ret = 0;
- char **i;
r = acquire_bus(&bus);
if (r < 0)
static int deactivate_home(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r, ret = 0;
- char **i;
r = acquire_bus(&bus);
if (r < 0)
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_(strv_freep) char **mangled_list = NULL;
int r, ret = 0;
- char **items, **i;
+ char **items;
pager_open(arg_pager_flags);
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_(strv_freep) char **mangled_list = NULL;
int r, ret = 0;
- char **i, **items;
+ char **items;
items = mangle_user_list(strv_skip(argv, 1), &mangled_list);
if (!items)
static int acquire_new_home_record(UserRecord **ret) {
_cleanup_(json_variant_unrefp) JsonVariant *v = NULL;
_cleanup_(user_record_unrefp) UserRecord *hr = NULL;
- char **i;
int r;
assert(ret);
static int remove_home(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r, ret = 0;
- char **i;
r = acquire_bus(&bus);
if (r < 0)
_cleanup_(json_variant_unrefp) JsonVariant *json = NULL;
_cleanup_(user_record_unrefp) UserRecord *hr = NULL;
- char **i;
int r;
assert(ret);
static int lock_home(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r, ret = 0;
- char **i;
r = acquire_bus(&bus);
if (r < 0)
static int unlock_home(int argc, char *argv[], void *userdata) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r, ret = 0;
- char **i;
r = acquire_bus(&bus);
if (r < 0)
HASHMAP_FOREACH(h, m->homes_by_name) {
_cleanup_(strv_freep) char **seats = NULL;
_cleanup_free_ char *home_path = NULL;
- char **s;
r = home_auto_login(h, &seats);
if (r < 0) {
static int manager_load_public_keys(Manager *m) {
_cleanup_strv_free_ char **files = NULL;
- char **i;
int r;
assert(m);
if (p.user_name) {
const char *last = NULL;
- char **i;
h = hashmap_get(m->homes_by_name, p.user_name);
if (!h)
} else {
const char *last_user_name = NULL, *last_group_name = NULL;
- HASHMAP_FOREACH(h, m->homes_by_name) {
- char **j;
-
+ HASHMAP_FOREACH(h, m->homes_by_name)
STRV_FOREACH(j, h->record->member_of) {
if (last_user_name) {
last_user_name = h->user_name;
last_group_name = *j;
}
- }
if (last_user_name) {
assert(last_group_name);
HomeSetup *setup) {
_cleanup_free_ char *chost = NULL, *cservice = NULL, *cdir = NULL, *chost_and_service = NULL, *j = NULL;
- char **pw;
int r;
assert(h);
const uint8_t match_key_descriptor[static FS_KEY_DESCRIPTOR_SIZE],
void **ret_decrypted, size_t *ret_decrypted_size) {
- char **i;
int r;
STRV_FOREACH(i, passwords) {
_cleanup_free_ char *d = NULL;
uint32_t nr = 0;
const char *ip;
- char **i;
int r;
assert(h);
size_t volume_key_size = 0;
uint32_t slot = 0;
const char *xa;
- char **p;
int r;
assert(h);
size_t *volume_key_size,
key_serial_t *ret_key_serial) {
- char **pp;
int r;
assert(h);
_cleanup_free_ char *text = NULL;
size_t volume_key_size;
int slot = 0, r;
- char **pp;
assert(node);
assert(dm_name);
const char *dm_name,
char **password) {
- char **pp;
int r;
assert(cd);
CK_TOKEN_INFO updated_token_info;
size_t decrypted_key_size;
CK_OBJECT_HANDLE object;
- char **i;
CK_RV rv;
int r;
log_info("None of the supplied plaintext passwords unlock the user record's hashed recovery keys.");
/* Second, test cached PKCS#11 passwords */
- for (size_t n = 0; n < h->n_pkcs11_encrypted_key; n++) {
- char **pp;
-
+ for (size_t n = 0; n < h->n_pkcs11_encrypted_key; n++)
STRV_FOREACH(pp, cache->pkcs11_passwords) {
r = test_password_one(h->pkcs11_encrypted_key[n].hashed_password, *pp);
if (r < 0)
return 1;
}
}
- }
/* Third, test cached FIDO2 passwords */
- for (size_t n = 0; n < h->n_fido2_hmac_salt; n++) {
- char **pp;
-
+ for (size_t n = 0; n < h->n_fido2_hmac_salt; n++)
/* See if any of the previously calculated passwords work */
STRV_FOREACH(pp, cache->fido2_passwords) {
r = test_password_one(h->fido2_hmac_salt[n].hashed_password, *pp);
return 1;
}
}
- }
/* Fourth, let's see if any of the PKCS#11 security tokens are plugged in and help us */
for (size_t n = 0; n < h->n_pkcs11_encrypted_key; n++) {
_cleanup_(strv_free_erasep) char **effective = NULL;
size_t n;
- char **i;
int r;
assert(h);
STRV_FOREACH(i, h->hashed_password) {
bool found = false;
- char **j;
log_debug("Looking for plaintext password for: %s", *i);
for (n = 0; n < h->n_recovery_key; n++) {
bool found = false;
- char **j;
log_debug("Looking for plaintext recovery key for: %s", h->recovery_key[n].hashed_password);
sd_bus_error *error) {
_cleanup_(sym_pwquality_free_settingsp) pwquality_settings_t *pwq = NULL;
- char buf[PWQ_MAX_ERROR_MESSAGE_LEN], **pp;
+ char buf[PWQ_MAX_ERROR_MESSAGE_LEN];
void *auxerror;
int r;
/* Iterate through all new passwords */
STRV_FOREACH(pp, secret->password) {
bool called = false;
- char **old;
r = test_password_many(hr->hashed_password, *pp);
if (r < 0)
}
int user_record_test_password(UserRecord *h, UserRecord *secret) {
- char **i;
int r;
assert(h);
}
int user_record_test_recovery_key(UserRecord *h, UserRecord *secret) {
- char **i;
int r;
assert(h);
int user_record_make_hashed_password(UserRecord *h, char **secret, bool extend) {
_cleanup_(json_variant_unrefp) JsonVariant *priv = NULL;
_cleanup_strv_free_ char **np = NULL;
- char **i;
int r;
assert(h);
static int verb_show(int argc, char **argv, void *userdata) {
_cleanup_(table_unrefp) Table *table = NULL;
- char **p;
int r;
argv = strv_skip(argv, 1);
const char* trust) {
int r, n, fd;
- char **file;
r = journal_remote_server_init(s, arg_output, arg_split_mode, arg_compress, arg_seal);
if (r < 0)
}
int setup_gnutls_logger(char **categories) {
- char **cat;
int r;
gnutls_global_set_log_function(log_func_gnutls);
- if (categories) {
+ if (categories)
STRV_FOREACH(cat, categories) {
r = log_enable_gnutls_category(*cat);
if (r < 0)
return r;
}
- } else
+ else
log_reset_gnutls_level();
return 0;
}
static int add_matches(sd_journal *j, char **args) {
- char **i;
bool have_term = false;
assert(j);
return r;
SD_JOURNAL_FOREACH_UNIQUE(j, data, size) {
- char **pattern, *eq;
+ char *eq;
size_t prefix;
_cleanup_free_ char *u = NULL;
static int add_units(sd_journal *j) {
_cleanup_strv_free_ char **patterns = NULL;
int r, count = 0;
- char **i;
assert(j);
static int add_syslog_identifier(sd_journal *j) {
int r;
- char **i;
assert(j);
case SD_DHCP_OPTION_USER_CLASS: {
size_t total = 0;
- char **s;
if (strv_isempty((char **) optval))
return -EINVAL;
int dhcp6_option_append_user_class(uint8_t **buf, size_t *buflen, char * const *user_class) {
_cleanup_free_ uint8_t *p = NULL;
size_t total = 0, offset = 0;
- char * const *s;
assert(buf);
assert(*buf);
_cleanup_free_ uint8_t *p = NULL;
uint32_t enterprise_identifier;
size_t total, offset;
- char * const *s;
assert(buf);
assert(*buf);
sd_dhcp_client *client,
char * const *user_class) {
- char * const *p;
char **s = NULL;
assert_return(client, -EINVAL);
}
int sd_dhcp6_client_set_request_user_class(sd_dhcp6_client *client, char * const *user_class) {
- char * const *p;
char **s;
assert_return(client, -EINVAL);
}
int sd_dhcp6_client_set_request_vendor_class(sd_dhcp6_client *client, char * const *vendor_class) {
- char * const *p;
char **s;
assert_return(client, -EINVAL);
_cleanup_free_ struct sd_radv_opt_dns *opt_dnssl = NULL;
size_t len = 0;
- char **s;
uint8_t *p;
assert_return(ra, -EINVAL);
r = sd_bus_creds_get_cmdline(c, &cmdline);
if (r >= 0) {
- char **i;
-
fprintf(f, "%sCommandLine=%s", prefix, color);
STRV_FOREACH(i, cmdline) {
if (i != cmdline)
fprintf(f, "%sUniqueName=%s%s%s", prefix, color, c->unique_name, suffix);
if (sd_bus_creds_get_well_known_names(c, &well_known) >= 0) {
- char **i;
-
fprintf(f, "%sWellKnownNames=%s", prefix, color);
STRV_FOREACH(i, well_known) {
if (i != well_known)
return true;
if (m->creds.mask & SD_BUS_CREDS_WELL_KNOWN_NAMES) {
- char **i;
-
/* on kdbus we have the well known names list
* in the credentials, let's make use of that
* for an accurate match */
return false;
case BUS_MATCH_ARG_HAS ... BUS_MATCH_ARG_HAS_LAST: {
- char **i;
-
STRV_FOREACH(i, value_strv)
if (streq_ptr(node->value.str, *i))
return true;
if (test_str)
found = hashmap_get(node->compare.children, test_str);
else if (test_strv) {
- char **i;
-
STRV_FOREACH(i, test_strv) {
found = hashmap_get(node->compare.children, *i);
if (found) {
}
_public_ int sd_bus_message_append_strv(sd_bus_message *m, char **l) {
- char **i;
int r;
assert_return(m, -EINVAL);
assert(s);
LIST_FOREACH(enumerators, c, first) {
- char **children = NULL, **k;
+ char **children = NULL;
sd_bus_slot *slot;
if (bus->nodes_modified)
bool has_invalidating = false, has_changing = false;
struct vtable_member key = {};
struct node *n;
- char **property;
void *u = NULL;
int r;
_public_ int sd_bus_emit_interfaces_added_strv(sd_bus *bus, const char *path, char **interfaces) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
struct node *object_manager;
- char **i;
int r;
assert_return(bus, -EINVAL);
assert_se(sd_bus_new(&b) >= 0);
if (!strv_isempty(saved_argv + 1)) {
- char **a;
STRV_FOREACH(a, saved_argv + 1)
test_one_address(b, *a, 0, NULL);
return;
int device_new_from_strv(sd_device **ret, char **strv) {
_cleanup_(sd_device_unrefp) sd_device *device = NULL;
- char **key;
const char *major = NULL, *minor = NULL;
int r;
int catalog_update(const char* database, const char* root, const char* const* dirs) {
_cleanup_strv_free_ char **files = NULL;
- char **f;
_cleanup_(strbuf_freep) struct strbuf *sb = NULL;
_cleanup_ordered_hashmap_free_free_free_ OrderedHashmap *h = NULL;
_cleanup_free_ CatalogItem *items = NULL;
}
int catalog_list_items(FILE *f, const char *database, bool oneline, char **items) {
- char **item;
int r = 0;
STRV_FOREACH(item, items) {
_public_ int sd_journal_open_files(sd_journal **ret, const char **paths, int flags) {
_cleanup_(sd_journal_closep) sd_journal *j = NULL;
- const char **path;
int r;
assert_return(ret, -EINVAL);
int sd_netlink_message_append_strv(sd_netlink_message *m, unsigned short type, char * const *data) {
size_t length, size;
- char * const *p;
int r;
assert_return(m, -EINVAL);
if (!n)
return -ENOMEM;
- char **i, **j = n;
+ char **j = n;
STRV_FOREACH(i, l) {
*j = path_join(*i, suffix);
if (!*j)
if (strv_isempty(i->locale))
puts(" System Locale: n/a");
else {
- char **j;
-
printf(" System Locale: %s\n", i->locale[0]);
STRV_FOREACH(j, i->locale + 1)
printf(" %s\n", *j);
Context *c = userdata;
bool modified = false;
int interactive, r;
- char **i;
bool use_localegen;
assert(m);
printf("\t State: %s\n", i.state);
if (!strv_isempty(i.sessions)) {
- char **l;
printf("\tSessions:");
STRV_FOREACH(l, i.sessions)
printf("%s\n", strna(i.id));
if (!strv_isempty(i.sessions)) {
- char **l;
printf("\tSessions:");
STRV_FOREACH(l, i.sessions) {
char **job) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL, *reply = NULL;
- char **i;
int r;
assert(manager);
}
static int apply_user_record_settings(pam_handle_t *handle, UserRecord *ur, bool debug) {
- char **i;
int r;
assert(handle);
} else {
_cleanup_strv_free_ char **files = NULL;
- char **fn, **i;
STRV_FOREACH(i, arg_proc_cmdline_modules) {
k = module_load_and_warn(ctx, *i, true);
void network_dump(Network *network, FILE *f) {
const char *dhcp;
- char **dns;
assert(network);
assert(f);
int netdev_load(Manager *manager, bool reload) {
_cleanup_strv_free_ char **files = NULL;
- char **f;
int r;
assert(manager);
if (!strv_fnmatch_full(patterns, str, 0, &pos) &&
!strv_fnmatch_full(patterns, name, 0, &pos)) {
bool match = false;
- char **p;
STRV_FOREACH(p, altnames)
if (strv_fnmatch_full(patterns, *p, 0, &pos)) {
break;
case SD_DHCP_LEASE_NTP: {
- char **i;
-
/* For NTP things are similar, but for NTP hostnames can be configured too, which we cannot
* propagate via DHCP. Hence let's only propagate those which are IP addresses. */
static int ntp_build_json(Link *link, JsonVariant **ret) {
JsonVariant **elements = NULL;
size_t n = 0;
- char **p;
int r;
assert(link);
JsonVariant **elements = NULL;
DHCPUseDomains use_domains;
union in_addr_union s;
- char **p, **domains;
+ char **domains;
const char *domain;
size_t n = 0;
int r;
_cleanup_strv_free_ char **ntp = NULL;
Link *l = userdata;
int r;
- char **i;
assert(message);
assert(l);
_cleanup_strv_free_ char **ntas = NULL;
Link *l = userdata;
int r;
- char **i;
assert(message);
assert(l);
}
static Link *link_drop(Link *link) {
- char **n;
-
if (!link)
return NULL;
static int link_update_alternative_names(Link *link, sd_netlink_message *message) {
_cleanup_strv_free_ char **altnames = NULL;
- char **n;
int r;
assert(link);
struct in6_addr router;
uint32_t lifetime_sec;
bool updated = false;
- char **j;
int r;
assert(link);
int network_load(Manager *manager, OrderedHashmap **networks) {
_cleanup_strv_free_ char **files = NULL;
- char **f;
int r;
assert(manager);
_cleanup_(bind_user_context_freep) BindUserContext *c = NULL;
uid_t current_uid = MAP_UID_MIN;
- char **n;
int r;
assert(custom_mounts);
}
if (m->type == CUSTOM_MOUNT_OVERLAY) {
- char **j;
-
STRV_FOREACH(j, m->lower) {
char *s;
if (!destination)
return -ENOMEM;
} else {
- char **i;
-
/* If more than two parameters are specified, the last one is the destination, the second to last one
* the "upper", and all before that the "lower" directories. */
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
uint64_t idx = 0;
- char **a, **b;
int r;
assert(machine_name);
int move_network_interfaces(int netns_fd, char **ifaces) {
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
- char **i;
int r;
if (strv_isempty(ifaces))
int setup_macvlan(const char *machine_name, pid_t pid, char **ifaces) {
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
unsigned idx = 0;
- char **i;
int r;
if (strv_isempty(ifaces))
int setup_ipvlan(const char *machine_name, pid_t pid, char **ifaces) {
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
- char **i;
int r;
if (strv_isempty(ifaces))
int remove_veth_links(const char *primary, char **pairs) {
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
- char **a, **b;
int r;
/* In some cases the kernel might pin the veth links between host and container even after the namespace
struct syscall_rule rule = {
.action = UINT32_MAX,
};
- char **i;
r = json_dispatch(e, table, oci_unexpected, flags, &rule);
if (r < 0)
};
_cleanup_strv_free_ char **added = NULL;
- char **p;
int r;
for (size_t i = 0; i < ELEMENTSOF(allow_list); i++) {
};
unsigned long flags;
- char **k, **v;
int r;
flags = effective_clone_ns_flags();
char *buffer,
size_t buflen) {
- char **array = NULL, *p, **m;
+ char **array = NULL, *p;
size_t required, n = 0, i = 0;
assert(g);
_cleanup_strv_free_ char **files = NULL;
Partition *last = NULL;
- char **f;
int r;
assert(context);
}
static int do_copy_files(Partition *p, const char *fs) {
- char **source, **target;
int r;
assert(p);
}
static int do_make_directories(Partition *p, const char *fs) {
- char **d;
int r;
assert(p);
static bool unit_match(const char *unit, char **matches) {
const char *dot;
- char **i;
dot = strrchr(unit, '.');
if (!dot)
_cleanup_close_ int os_release_fd = -1;
_cleanup_free_ char *os_release_path = NULL;
const char *os_release_id;
- char **i;
int r;
/* Extracts the metadata from a directory tree 'where'. Extracts two kinds of information: the /etc/os-release
return r;
if (!strv_isempty(extension_image_paths)) {
- char **p;
-
extension_images = ordered_hashmap_new(&image_hash_ops);
if (!extension_images)
return -ENOMEM;
}
static bool prefix_matches_compatible(char **matches, char **valid_prefixes) {
- char **m;
-
/* Checks if all 'matches' are included in the list of 'valid_prefixes' */
STRV_FOREACH(m, matches)
static bool marker_matches_images(const char *marker, const char *name_or_path, char **extension_image_paths) {
_cleanup_strv_free_ char **root_and_extensions = NULL;
- char **image_name_or_path;
const char *a;
int r;
}
static int attach_extensions_to_message(sd_bus_message *m, char **extensions) {
- char **p;
int r;
assert(m);
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
_cleanup_strv_free_ char **l = NULL;
- char **i;
int r;
r = acquire_bus(&bus);
static int verb_query(int argc, char **argv, void *userdata) {
sd_bus *bus = userdata;
- char **p;
int q, r = 0;
if (arg_type != 0)
static int verb_openpgp(int argc, char **argv, void *userdata) {
sd_bus *bus = userdata;
- char **p;
int q, r = 0;
STRV_FOREACH(p, argv + 1) {
static int verb_tlsa(int argc, char **argv, void *userdata) {
sd_bus *bus = userdata;
- char **p, **args = argv + 1;
+ char **args = argv + 1;
const char *family = "tcp";
int q, r = 0;
printf("%s%nGlobal%n%s:", ansi_highlight(), &pos1, &pos2, ansi_normal());
size_t cols = columns(), position = pos2 - pos1 + 2;
- char **i;
STRV_FOREACH(i, p) {
size_t our_len = utf8_console_width(*i); /* This returns -1 on invalid utf-8 (which shouldn't happen).
int r = 0;
if (argc > 1) {
- char **ifname;
bool empty_line = false;
STRV_FOREACH(ifname, argv + 1) {
static int call_dns(sd_bus *bus, char **dns, const BusLocator *locator, sd_bus_error *error, bool extended) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *req = NULL;
- char **p;
int r;
r = bus_message_new_method_call(bus, &req, locator, extended ? "SetLinkDNSEx" : "SetLinkDNS");
static int call_domain(sd_bus *bus, char **domain, const BusLocator *locator, sd_bus_error *error) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *req = NULL;
- char **p;
int r;
r = bus_message_new_method_call(bus, &req, locator, "SetLinkDomains");
static int verb_nta(int argc, char **argv, void *userdata) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus *bus = userdata;
- char **p;
int r;
bool clear;
int (*loader)(DnsTrustAnchor *d, const char *path, unsigned n, const char *line)) {
_cleanup_strv_free_ char **files = NULL;
- char **f;
int r;
assert(d);
int dnssd_load(Manager *manager) {
_cleanup_strv_free_ char **files = NULL;
- char **f;
int r;
assert(manager);
for (size_t j = 0; j < ELEMENTSOF(local_in_addrs); j++) {
bool all_localhost, in_order;
- char **i;
item = hashmap_get(hosts->by_address, local_in_addrs + j);
if (!item)
}
if (found_ptr) {
- char **n;
-
r = dns_answer_reserve(answer, strv_length(item->names));
if (r < 0)
return r;
_cleanup_free_ char *j = NULL;
Link *l = userdata;
int r;
- char **i;
assert(message);
assert(l);
static int link_update_dns_servers(Link *l) {
_cleanup_strv_free_ char **nameservers = NULL;
- char **nameserver;
int r;
assert(l);
static int link_update_search_domains(Link *l) {
_cleanup_strv_free_ char **sdomains = NULL, **rdomains = NULL;
- char **i;
int r, q;
assert(l);
static int generate(void) {
_cleanup_fclose_ FILE *f = NULL;
const char *p;
- char **c;
int r;
if (strv_isempty(arg_commands) && !arg_success_action)
int parse_acl(const char *text, acl_t *acl_access, acl_t *acl_default, bool want_mask) {
_cleanup_free_ char **a = NULL, **d = NULL; /* strings are not freed */
_cleanup_strv_free_ char **split = NULL;
- char **entry;
int r = -EINVAL;
_cleanup_(acl_freep) acl_t a_acl = NULL, d_acl = NULL;
size_t *n_entries) {
_cleanup_strv_free_ char **files = NULL;
- char **f;
int r;
assert(root);
"auto-reboot-to-firmware-setup", "Reboot Into Firmware Interface",
};
- char **i;
-
assert(config);
/* Let's add the entries discovered by the boot loader to the end of our list, unless they are
STRV_FOREACH(i, found_by_loader) {
BootEntry *existing;
_cleanup_free_ char *c = NULL, *t = NULL, *p = NULL;
- char **a, **b;
existing = boot_config_find_entry(config, *i);
if (existing) {
sd_bus_message *m,
const char **l) {
- const char **k, **v;
int r;
assert(m);
if (streq(field, "RootImageOptions")) {
_cleanup_strv_free_ char **l = NULL;
- char **first = NULL, **second = NULL;
const char *p = eq;
r = sd_bus_message_open_container(m, SD_BUS_TYPE_STRUCT, "sv");
if (r < 0)
return bus_log_create_error(r);
- char **source, **destination;
STRV_FOREACH_PAIR(source, destination, symlinks) {
r = sd_bus_message_append(m, "(sst)", *source, *destination, 0);
if (r < 0)
}
int bus_append_unit_property_assignment_many(sd_bus_message *m, UnitType t, char **l) {
- char **i;
int r;
assert(m);
int bus_track_add_name_many(sd_bus_track *t, char **l) {
int r = 0;
- char **i;
assert(t);
int bus_reply_pair_array(sd_bus_message *m, char **l) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
- char **k, **v;
int r;
assert(m);
static int cg_any_controller_used_for_v1(void) {
_cleanup_free_ char *buf = NULL;
_cleanup_strv_free_ char **lines = NULL;
- char **line;
int r;
r = read_full_virtual_file("/proc/cgroups", &buf, NULL);
static int condition_test_environment(Condition *c, char **env) {
bool equal;
- char **i;
assert(c);
assert(c->parameter);
_cleanup_hashmap_free_ Hashmap *stats_by_path = NULL;
struct stat st;
- char **fn;
int r;
if (ret_stats_by_path) {
_cleanup_(release_lock_file) LockFile global_lock = LOCK_FILE_INIT, local_lock = LOCK_FILE_INIT;
_cleanup_strv_free_ char **settings = NULL;
_cleanup_free_ char *roothash = NULL;
- char **j;
int r;
assert(i);
return -EOPNOTSUPP;
}
- STRV_FOREACH(j, settings) {
+ STRV_FOREACH(j, settings)
if (unlink(*j) < 0 && errno != ENOENT)
log_debug_errno(errno, "Failed to unlink %s, ignoring: %m", *j);
- }
if (unlink(roothash) < 0 && errno != ENOENT)
log_debug_errno(errno, "Failed to unlink %s, ignoring: %m", roothash);
_cleanup_free_ char *new_path = NULL, *nn = NULL, *roothash = NULL;
_cleanup_strv_free_ char **settings = NULL;
unsigned file_attr = 0;
- char **j;
int r;
assert(i);
_cleanup_strv_free_ char **settings = NULL;
_cleanup_free_ char *roothash = NULL;
const char *new_path;
- char **j;
int r;
assert(i);
_cleanup_(BIO_freep) BIO *bio = NULL; /* 'bio' must be freed first, 's' second, hence keep this order
* of declaration in place, please */
const unsigned char *d;
- char **i;
int r;
assert(verity);
_cleanup_strv_free_ char **dirs = NULL;
const char *n;
- char **p;
int r;
assert(ret);
_cleanup_hashmap_free_free_ Hashmap *pids = NULL;
_cleanup_strv_free_ char **paths = NULL;
- char **path, **e;
int r;
bool parallel_execution;
}
static int gather_environment_generate(int fd, void *arg) {
- char ***env = arg, **x, **y;
+ char ***env = arg;
_cleanup_fclose_ FILE *f = NULL;
_cleanup_strv_free_ char **new = NULL;
int r;
int exec_command_flags_from_strv(char **ex_opts, ExecCommandFlags *flags) {
ExecCommandFlags ex_flag, ret_flags = 0;
- char **opt;
assert(flags);
return NULL;
size_t position = 0;
- char **p;
STRV_FOREACH(p, strv) {
size_t our_len = utf8_console_width(*p); /* This returns -1 on invalid utf-8 (which shouldn't happen).
* If that happens, we'll just print one item per line. */
static int insert_data(struct trie *trie, char **match_list, char *line, const char *filename,
uint16_t file_priority, uint32_t line_number, bool compat) {
- char *value, **entry;
+ char *value;
assert(line[0] == ' ');
_cleanup_free_ char *hwdb_bin = NULL;
_cleanup_(trie_freep) struct trie *trie = NULL;
_cleanup_strv_free_ char **files = NULL;
- char **f;
uint16_t file_priority = 1;
int r = 0, err;
bool same_name_link_runtime = false, same_name_link_config = false;
bool enabled_in_runtime = false, enabled_at_all = false;
bool ignore_same_name = false;
- char **p;
int r;
assert(lp);
_cleanup_free_ char *template = NULL;
bool found_unit = false;
int r, result;
- char **p;
assert(info);
assert(lp);
UnitFileChange **changes,
size_t *n_changes) {
- char **s;
int r = 0, q;
assert(i);
_cleanup_free_ char *buf = NULL;
UnitNameFlags valid_dst_type = UNIT_NAME_ANY;
const char *n;
- char **s;
int r = 0, q;
assert(i);
_cleanup_(lookup_paths_free) LookupPaths lp = {};
const char *config_path;
- char **i;
int r;
assert(scope >= 0);
_cleanup_strv_free_ char **todo = NULL;
const char *config_path;
size_t n_todo = 0;
- char **i;
int r, q;
assert(scope >= 0);
_cleanup_strv_free_ char **todo = NULL;
const char *config_path;
size_t n_todo = 0;
- char **i;
int r, q;
assert(scope >= 0);
_cleanup_(lookup_paths_free) LookupPaths lp = {};
_cleanup_strv_free_ char **todo = NULL;
size_t n_todo = 0;
- char **i;
int r, q;
/* Puts a unit file back into vendor state. This means:
STRV_FOREACH(i, files) {
bool has_vendor = false;
- char **p;
if (!unit_name_is_valid(*i, UNIT_NAME_ANY))
return -EINVAL;
STRV_FOREACH(i, todo) {
_cleanup_strv_free_ char **fs = NULL;
const char *rp;
- char **j;
(void) get_files_in_directory(*i, &fs);
_cleanup_(install_context_done) InstallContext c = {};
UnitFileInstallInfo *i, *target_info;
const char *config_path;
- char **f;
int r;
assert(scope >= 0);
_cleanup_(install_context_done) InstallContext c = {};
const char *config_path;
UnitFileInstallInfo *i;
- char **f;
int r;
assert(scope >= 0);
_cleanup_(install_context_done) InstallContext c = {};
_cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
const char *config_path;
- char **i;
int r;
assert(scope >= 0);
static int read_presets(UnitFileScope scope, const char *root_dir, UnitFilePresets *presets) {
_cleanup_(unit_file_presets_freep) UnitFilePresets ps = {};
_cleanup_strv_free_ char **files = NULL;
- char **p;
int r;
assert(scope >= 0);
if (unit_name_is_valid(unit_name, UNIT_NAME_TEMPLATE)) {
_cleanup_strv_free_ char **out_strv = NULL;
- char **iter;
STRV_FOREACH(iter, rule.instances) {
_cleanup_free_ char *name = NULL;
log_debug("Preset files don't specify rule for %s. Enabling.", name);
return 1;
case PRESET_ENABLE:
- if (instance_name_list && *instance_name_list) {
- char **s;
+ if (instance_name_list && *instance_name_list)
STRV_FOREACH(s, *instance_name_list)
log_debug("Preset files say enable %s.", *s);
- } else
+ else
log_debug("Preset files say enable %s.", name);
return 1;
case PRESET_DISABLE:
return r;
if (r > 0) {
- if (instance_name_list) {
- char **s;
+ if (instance_name_list)
STRV_FOREACH(s, instance_name_list) {
r = install_info_discover_and_check(scope, plus, lp, *s, SEARCH_LOAD|SEARCH_FOLLOW_CONFIG_SYMLINKS,
&i, changes, n_changes);
if (r < 0)
return r;
}
- } else {
+ else {
r = install_info_discover_and_check(scope, plus, lp, name, SEARCH_LOAD|SEARCH_FOLLOW_CONFIG_SYMLINKS,
&i, changes, n_changes);
if (r < 0)
_cleanup_(lookup_paths_free) LookupPaths lp = {};
_cleanup_(unit_file_presets_freep) UnitFilePresets presets = {};
const char *config_path;
- char **i;
int r;
assert(scope >= 0);
_cleanup_(lookup_paths_free) LookupPaths lp = {};
_cleanup_(unit_file_presets_freep) UnitFilePresets presets = {};
const char *config_path = NULL;
- char **i;
int r;
assert(scope >= 0);
char **patterns) {
_cleanup_(lookup_paths_free) LookupPaths lp = {};
- char **dirname;
int r;
assert(scope >= 0);
}
int test_password_many(char **hashed_password, const char *password) {
- char **hpw;
int r;
STRV_FOREACH(hpw, hashed_password) {
bool retry_with_up = false, retry_with_pin = false;
if (FLAGS_SET(required, FIDO2ENROLL_PIN)) {
- char **i;
-
/* OK, we need a pin, try with all pins in turn */
if (strv_isempty(pins))
r = FIDO_ERR_PIN_REQUIRED;
for (;;) {
_cleanup_(strv_free_erasep) char **pin = NULL;
- char **i;
r = ask_password_auto("Please enter security token PIN:", askpw_icon_name, NULL, "fido2-pin", "fido2-pin", USEC_INFINITY, 0, &pin);
if (r < 0)
NULL
};
- const char *const *x, *const *y;
-
assert(controller);
/* This will lookup which controller to mount another controller with. Input is a controller name, and output
static int relabel_extra(void) {
_cleanup_strv_free_ char **files = NULL;
- char **file;
int r, c = 0;
/* Support for relabelling additional files or directories after loading the policy. For this, code in the
* we shall operate on. */
if (!path_equal(path, prefix)) {
bool deny_listed = false;
- char **i;
STRV_FOREACH(i, deny_list) {
if (path_equal(*i, prefix))
}
static bool net_condition_test_strv(char * const *patterns, const char *string) {
- char * const *p;
bool match = false, has_positive_rule = false;
if (strv_isempty(patterns))
if (net_condition_test_strv(patterns, ifname))
return true;
- char * const *p;
STRV_FOREACH(p, alternative_names)
if (net_condition_test_strv(patterns, *p))
return true;
}
static int net_condition_test_property(char * const *match_property, sd_device *device) {
- char * const *p;
-
if (strv_isempty(match_property))
return true;
int nscd_flush_cache(char **databases) {
usec_t end;
int r = 0;
- char **i;
/* Tries to invalidate the specified database in nscd. We do this carefully, with a 5s timeout, so that we
* don't block indefinitely on another service. */
for (unsigned tries = 0; tries < 3; tries++) {
_cleanup_strv_free_erase_ char **passwords = NULL;
_cleanup_(erase_and_freep) char *envpin = NULL;
- char **i;
r = getenv_steal_erase("PIN", &envpin);
if (r < 0)
}
int cat_files(const char *file, char **dropins, CatFlags flags) {
- char **path;
int r;
if (file) {
int conf_files_cat(const char *root, const char *name) {
_cleanup_strv_free_ char **dirs = NULL, **files = NULL;
_cleanup_free_ char *path = NULL;
- char **prefix, **prefixes = NULL; /* explicit initialization to appease gcc */
+ char **prefixes = NULL; /* explicit initialization to appease gcc */
bool is_collection;
const char *extension;
- char **t;
int r;
r = guess_type(&name, &prefixes, &is_collection, &extension);
int parse_syscall_archs(char **l, Set **ret_archs) {
_cleanup_set_free_ Set *archs = NULL;
- char **s;
int r;
assert(l);
int serialize_strv(FILE *f, const char *key, char **l) {
int ret = 0, r;
- char **i;
/* Returns the first error, or positive if anything was serialized, 0 otherwise. */
_cleanup_free_ char *s = NULL;
_cleanup_free_ char *envpath = NULL;
_cleanup_strv_free_ char **pairs = NULL;
- char **k, **v;
if (called)
return;
break;
}
bool has_valid_passwords = false;
- char **p;
STRV_FOREACH(p, hr->hashed_password)
if (!hashed_password_is_locked_or_invalid(*p)) {
has_valid_passwords = true;
if (hr->preferred_language)
printf(" Language: %s\n", hr->preferred_language);
- if (!strv_isempty(hr->environment)) {
- char **i;
-
+ if (!strv_isempty(hr->environment))
STRV_FOREACH(i, hr->environment) {
printf(i == hr->environment ?
" Environment: %s\n" :
" %s\n", *i);
}
- }
if (hr->locked >= 0)
printf(" Locked: %s\n", yes_no(hr->locked));
if (!strv_isempty(hr->ssh_authorized_keys))
printf("SSH Pub. Key: %zu\n", strv_length(hr->ssh_authorized_keys));
- if (!strv_isempty(hr->pkcs11_token_uri)) {
- char **i;
-
+ if (!strv_isempty(hr->pkcs11_token_uri))
STRV_FOREACH(i, hr->pkcs11_token_uri)
printf(i == hr->pkcs11_token_uri ?
"PKCS11 Token: %s\n" :
" %s\n", *i);
- }
if (hr->n_fido2_hmac_credential > 0)
printf(" FIDO2 Token: %zu\n", hr->n_fido2_hmac_credential);
}
} else {
const char *prefix = " Members:";
- char **i;
STRV_FOREACH(i, gr->members) {
printf("%s %s\n", prefix, *i);
if (!strv_isempty(gr->administrators)) {
const char *prefix = " Admins:";
- char **i;
STRV_FOREACH(i, gr->administrators) {
printf("%s %s\n", prefix, *i);
static int write_mode(char **modes) {
int r = 0;
- char **mode;
STRV_FOREACH(mode, modes) {
int k;
}
static int write_state(FILE **f, char **states) {
- char **state;
int r = 0;
assert(f);
DEFINE_HASH_OPS_WITH_VALUE_DESTRUCTOR(option_hash_ops, char, string_hash_func, string_compare_func, Option, option_free);
static bool test_prefix(const char *p) {
- char **i;
-
if (strv_isempty(arg_prefixes))
return true;
if (string_is_glob(option->key)) {
_cleanup_strv_free_ char **paths = NULL;
_cleanup_free_ char *pattern = NULL;
- char **s;
pattern = path_join("/proc/sys", option->key);
if (!pattern)
}
} else {
_cleanup_strv_free_ char **files = NULL;
- char **f;
r = conf_files_list_strv(&files, ".conf", NULL, 0, (const char**) CONF_PATHS_STRV("sysctl.d"));
if (r < 0)
static int unmerge(void) {
int r, ret = 0;
- char **p;
STRV_FOREACH(p, arg_hierarchies) {
_cleanup_free_ char *resolved = NULL;
static int verb_status(int argc, char **argv, void *userdata) {
_cleanup_(table_unrefp) Table *t = NULL;
int r, ret = 0;
- char **p;
t = table_new("hierarchy", "extensions", "since");
if (!t)
_cleanup_free_ char *options = NULL;
bool separator = false;
- char **l;
int r;
assert(where);
_cleanup_free_ char *resolved_hierarchy = NULL, *f = NULL, *buf = NULL;
_cleanup_strv_free_ char **layers = NULL;
struct stat st;
- char **p;
int r;
assert(hierarchy);
size_t n_extensions = 0;
unsigned n_ignored = 0;
Image *img;
- char **h;
int r;
/* Mark the whole of /run as MS_SLAVE, so that we can mount stuff below it that doesn't show up on
static int verb_merge(int argc, char **argv, void *userdata) {
_cleanup_(hashmap_freep) Hashmap *images = NULL;
- char **p;
int r;
if (!have_effective_cap(CAP_SYS_ADMIN))
int verb_cancel(int argc, char *argv[], void *userdata) {
sd_bus *bus;
- char **name;
int r;
if (argc <= 1) /* Shortcut to trivial_method() if no argument is given */
_cleanup_(bus_wait_for_units_freep) BusWaitForUnits *w = NULL;
_cleanup_strv_free_ char **names = NULL;
int r, ret = EXIT_SUCCESS;
- char **name;
const char *method;
sd_bus *bus;
_cleanup_(hashmap_freep) Hashmap *cached_name_map = NULL, *cached_id_map = NULL;
_cleanup_(lookup_paths_free) LookupPaths lp = {};
_cleanup_strv_free_ char **names = NULL;
- char **name;
sd_bus *bus;
bool first = true;
int r, rc = 0;
} else if (original_unit_paths) {
_cleanup_free_ char *new_contents = NULL;
_cleanup_fclose_ FILE *f = NULL;
- char **path;
r = mac_selinux_create_file_prepare(new_path, S_IFREG);
if (r < 0)
if (r < 0)
return r;
if (r == 0) {
- char **editor_args = NULL, **tmp_path, **original_path;
+ char **editor_args = NULL;
size_t n_editor_args = 0, i = 1, argc;
const char **args, *editor, *p;
static int find_paths_to_edit(sd_bus *bus, char **names, char ***paths) {
_cleanup_(hashmap_freep) Hashmap *cached_name_map = NULL, *cached_id_map = NULL;
_cleanup_(lookup_paths_free) LookupPaths lp = {};
- char **name;
int r;
assert(names);
_cleanup_(lookup_paths_free) LookupPaths lp = {};
_cleanup_strv_free_ char **names = NULL;
_cleanup_strv_free_ char **paths = NULL;
- char **original, **tmp;
sd_bus *bus;
int r;
#include "systemctl.h"
static int normalize_filenames(char **names) {
- char **u;
int r;
STRV_FOREACH(u, names)
}
static int normalize_names(char **names) {
- char **u;
bool was_path = false;
STRV_FOREACH(u, names) {
sd_bus *bus;
if (STR_IN_SET(verb, "mask", "unmask")) {
- char **name;
_cleanup_(lookup_paths_free) LookupPaths lp = {};
r = lookup_paths_init(&lp, arg_scope, 0, arg_root);
_cleanup_strv_free_ char **names = NULL;
UnitActiveState active_state;
sd_bus *bus;
- char **name;
int r;
bool found = false;
int verb_is_enabled(int argc, char *argv[], void *userdata) {
_cleanup_strv_free_ char **names = NULL;
bool enabled;
- char **name;
int r;
r = mangle_names("to check", strv_skip(argv, 1), &names);
int verb_kill(int argc, char *argv[], void *userdata) {
_cleanup_strv_free_ char **names = NULL;
- char *kill_who = NULL, **name;
+ char *kill_who = NULL;
sd_bus *bus;
int r, q;
unsigned branches) {
_cleanup_strv_free_ char **deps = NULL;
- char **c;
int r;
assert(bus);
int verb_list_dependencies(int argc, char *argv[], void *userdata) {
_cleanup_strv_free_ char **units = NULL, **done = NULL;
- char **u, **patterns;
+ char **patterns;
sd_bus *bus;
int r;
struct machine_info *machine_infos = NULL;
_cleanup_strv_free_ char **m = NULL;
_cleanup_free_ char *hn = NULL;
- char **i;
int c = 0, r;
hn = gethostname_malloc();
if (arg_recursive) {
_cleanup_strv_free_ char **machines = NULL;
- char **i;
r = sd_get_machine_names(&machines);
if (r < 0)
uint32_t uid, pid;
sd_bus *bus;
unsigned c = 0;
- char **s;
int r;
if (arg_check_inhibitors == 0 || arg_force > 0)
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_strv_free_ char **l = NULL;
sd_bus *bus;
- char **i;
int r;
r = acquire_bus(BUS_FULL, &bus);
int verb_reset_failed(int argc, char *argv[], void *userdata) {
_cleanup_strv_free_ char **names = NULL;
sd_bus *bus;
- char **name;
int r, q;
if (argc <= 1) /* Shortcut to trivial_method() if no argument is given */
strv_env_clean_with_callback(copy, invalid_callback, NULL);
- char **e;
STRV_FOREACH(e, copy)
if (string_has_cc(*e, NULL))
log_notice("Environment variable $%.*s contains control characters, importing anyway.",
r = sd_bus_message_append_strv(m, copy);
} else {
- char **a, **b;
-
r = sd_bus_message_open_container(m, 'a', "s");
if (r < 0)
return bus_log_create_error(r);
int verb_set_property(int argc, char *argv[], void *userdata) {
sd_bus *bus;
_cleanup_strv_free_ char **names = NULL;
- char **name;
int r, k;
r = acquire_bus(BUS_MANAGER, &bus);
_cleanup_free_ char *formatted_path = NULL;
usec_t timestamp;
const char *path;
- char **t, **t2;
int r;
assert(i);
if (!strv_isempty(i->dropin_paths)) {
_cleanup_free_ char *dir = NULL;
bool last = false;
- char ** dropin;
STRV_FOREACH(dropin, i->dropin_paths) {
_cleanup_free_ char *dropin_formatted = NULL;
}
static void show_unit_help(UnitStatusInfo *i) {
- char **p;
-
assert(i);
if (!i->documentation) {
if (FLAGS_SET(flags, BUS_PRINT_PROPERTY_SHOW_EMPTY) || allow_list || !strv_isempty(l)) {
bool first = true;
- char **i;
if (!FLAGS_SET(flags, BUS_PRINT_PROPERTY_ONLY_VALUE)) {
fputs(name, stdout);
.io_read_bytes = UINT64_MAX,
.io_write_bytes = UINT64_MAX,
};
- char **pp;
int r;
assert(path);
ret = show_all(bus, &new_line, &ellipsized);
} else {
_cleanup_free_ char **patterns = NULL;
- char **name;
STRV_FOREACH(name, strv_skip(argv, 1)) {
_cleanup_free_ char *path = NULL, *unit = NULL;
if (r < 0)
return bus_log_parse_error(r);
- if (w) {
- char **path;
-
+ if (w)
STRV_FOREACH(path, paths) {
log_debug("Adding %s to the set", *path);
r = bus_wait_for_jobs_add(w, *path);
if (r < 0)
return log_error_errno(r, "Failed to watch job %s: %m", *path);
}
- }
return 0;
}
_cleanup_strv_free_ char **names = NULL;
int r, ret = EXIT_SUCCESS;
sd_bus *bus;
- char **name;
if (arg_wait && !STR_IN_SET(argv[0], "start", "restart"))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
int expand_unit_names(sd_bus *bus, char **names, const char* suffix, char ***ret, bool *ret_expanded) {
_cleanup_strv_free_ char **mangled = NULL, **globs = NULL;
- char **name;
int r;
assert(bus);
_cleanup_strv_free_ char **triggered_by = NULL;
bool print_warning_label = true;
UnitActiveState active_state;
- char **i;
int r;
r = unit_name_mangle(unit, 0, &n);
}
int unit_file_find_path(LookupPaths *lp, const char *unit_name, char **ret_unit_path) {
- char **p;
-
assert(lp);
assert(unit_name);
int append_unit_dependencies(sd_bus *bus, char **names, char ***ret) {
_cleanup_strv_free_ char **with_deps = NULL;
- char **name;
assert(bus);
assert(ret);
int mangle_names(const char *operation, char **original_names, char ***ret_mangled_names) {
_cleanup_strv_free_ char **l = NULL;
- char **i, **name;
+ char **i;
int r;
assert(ret_mangled_names);
if (a) {
_cleanup_strv_free_ char **l = NULL;
bool added = false;
- char **i;
l = strv_copy(gr->gr_mem);
if (!l)
if (a) {
_cleanup_strv_free_ char **l = NULL;
bool added = false;
- char **i;
l = strv_copy(sg->sg_mem);
if (!l)
/* Implicitly create additional users and groups, if they were listed in "m" lines */
ORDERED_HASHMAP_FOREACH_KEY(l, g, members) {
- char **m;
-
STRV_FOREACH(m, l)
if (!ordered_hashmap_get(users, *m)) {
_cleanup_(item_freep) Item *j = NULL;
}
static int parse_arguments(char **args) {
- char **arg;
unsigned pos = 1;
int r;
static int read_config_files(char **args) {
_cleanup_strv_free_ char **files = NULL;
_cleanup_free_ char *p = NULL;
- char **f;
int r;
r = conf_files_list_with_replacement(arg_root, CONF_PATHS_STRV("sysusers.d"), arg_replace, &files, &p);
_cleanup_free_ char *path_escaped = NULL;
_cleanup_fclose_ FILE *f = NULL;
const char *unit;
- char **p;
int r;
assert(s);
static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) {
_cleanup_strv_free_ char **sysvinit_path = NULL;
- char **path;
int r;
assert(lp);
Set *runlevel_services[ELEMENTSOF(rcnd_table)] = {};
_cleanup_strv_free_ char **sysvrcnd_path = NULL;
SysvStub *service;
- char **p;
int r;
assert(lp);
}
static char **unlink_paths_and_free(char **paths) {
- char **i;
-
STRV_FOREACH(i, paths)
(void) unlink(*i);
_cleanup_free_ char *exec_start = NULL;
_cleanup_(unit_freep) Unit *u = NULL;
ExecContext *ec = NULL;
- char **allow_filesystem;
int cld_code, r;
assert_se(u = unit_new(m, sizeof(Service)));
char **hardlinks = STRV_MAKE("hlink", "file",
"hlink2", "dir1/file");
const char *unixsockp;
- char **p, **ll;
struct stat st;
int xattr_worked = -1; /* xattr support is optional in temporary directories, hence use it if we can,
* but don't fail if we can't */
r = safe_fork("(sd-getenvstealerase)", FORK_DEATHSIG|FORK_LOG|FORK_WAIT, NULL);
if (r == 0) {
_cleanup_strv_free_ char **l = NULL;
- char **e;
/* child */
return 0;
}
static int gather_stdout_two(int fd, void *arg) {
- char ***s = arg, **t;
+ char ***s = arg;
STRV_FOREACH(t, *s)
assert_se(write(fd, *t, strlen(*t)) == (ssize_t) strlen(*t));
TEST(environment_gathering) {
_cleanup_(rm_rf_physical_and_freep) char *tmpdir = NULL;
const char *name, *name2, *name3, *old;
- char **p;
int r;
char **tmp = NULL; /* this is only used in the forked process, no cleanup here */
_cleanup_strv_free_ char **v = NULL;
assert_se(strv_split_newlines_full(&v, result, 0) >= 0);
- char **q;
STRV_FOREACH(q, v) {
_cleanup_free_ char *word = NULL;
const char *p = *q;
assert_se(strextend(&data, "BindReadOnlyPaths=", fullpath_touch, "\n"));
assert_se(strextend(&data, "BindReadOnlyPaths=", fullpath_test, "\n"));
- char **p;
STRV_FOREACH(p, libraries)
assert_se(strextend(&data, "BindReadOnlyPaths=", *p, "\n"));
*six = NULL, *seven = NULL, *eight = NULL, *nine = NULL, *ten = NULL,
*eleven = NULL, *twelve = NULL, *thirteen = NULL;
_cleanup_strv_free_ char **a = NULL, **b = NULL;
- char **i;
unsigned k;
int r;
p[] = "/tmp/test-fileio-out-XXXXXX";
FILE *f;
_cleanup_strv_free_ char **a = NULL, **b = NULL;
- char **i;
int r;
assert_se(fmkostemp_safe(t, "w", &f) == 0);
_cleanup_(unlink_tempfilep) char t[] = "/tmp/test-fileio-XXXXXX";
_cleanup_fclose_ FILE *f = NULL;
_cleanup_strv_free_ char **a = NULL;
- char **i;
int r;
assert_se(fmkostemp_safe(t, "w", &f) == 0);
_cleanup_(unlink_tempfilep) char t[] = "/tmp/test-fileio-XXXXXX";
_cleanup_fclose_ FILE *f = NULL;
_cleanup_strv_free_ char **a = NULL;
- char **i;
int r;
assert_se(fmkostemp_safe(t, "w", &f) == 0);
int fd, r;
_cleanup_fclose_ FILE *f = NULL;
_cleanup_strv_free_ char **l = NULL;
- char **k, **v;
fd = mkostemp_safe(fn);
assert_se(fd >= 0);
_cleanup_(rm_rf_physical_and_freep) char *z = NULL;
const char *j = NULL;
- char **a, **b;
if (arg_test_dir)
j = strjoina(arg_test_dir, "/testXXXXXX");
int main(int argc, char *argv[]) {
_cleanup_strv_free_ char **maps = NULL;
- char **m;
int r;
log_show_color(true);
TEST(get_locales) {
_cleanup_strv_free_ char **locales = NULL;
- char **p;
int r;
r = get_locales(&locales);
TEST(keymaps) {
_cleanup_strv_free_ char **kmaps = NULL;
- char **p;
int r;
assert_se(!keymap_is_valid(""));
}
static void print_struct_hostent(struct hostent *host, const char *canon) {
- char **s;
-
log_info(" \"%s\"", host->h_name);
STRV_FOREACH(s, host->h_aliases)
log_info(" alias \"%s\"", *s);
if (!handle)
return -EINVAL;
- char **name;
STRV_FOREACH(name, names)
test_byname(handle, module, *name);
assert_se(modules);
if (argc > 2) {
- char **name;
int family;
union in_addr_union address;
_cleanup_strv_free_ char **modules = NULL, **names = NULL;
_cleanup_free_ struct local_address *addresses = NULL;
int n_addresses = 0;
- char **module;
int r;
test_setup_logging(LOG_INFO);
if (!handle)
return -EINVAL;
- char **name;
STRV_FOREACH(name, names)
test_byname(handle, module, *name);
static int run(int argc, char **argv) {
_cleanup_free_ char *dir = NULL;
_cleanup_strv_free_ char **modules = NULL, **names = NULL;
- char **module;
int r;
test_setup_logging(LOG_INFO);
TEST(user_and_global_paths) {
_cleanup_(lookup_paths_free) LookupPaths lp_global = {}, lp_user = {};
- char **u, **g, **p;
+ char **u, **g;
unsigned k = 0;
assert_se(unsetenv("SYSTEMD_UNIT_PATH") == 0);
_cleanup_strv_free_ char **env_gp_with_env = NULL;
char *systemd_generator_path = NULL;
char *systemd_env_generator_path = NULL;
- char **dir;
assert_se(mkdtemp_malloc("/tmp/test-path-lookup.XXXXXXX", &tmp) >= 0);
char tmp_dir[] = "/tmp/test-path-util-XXXXXX";
_cleanup_strv_free_ char **search_dirs = NULL;
_cleanup_strv_free_ char **absolute_dirs = NULL;
- char **d;
assert_se(mkdtemp(tmp_dir) != NULL);
static int setup_test(Manager **m) {
char **tests_path = STRV_MAKE("exists", "existsglobFOOBAR", "changed", "modified", "unit",
"directorynotempty", "makedirectory");
- char **test_path;
Manager *tmp = NULL;
int r;
TEST(sd_path_lookup_strv) {
for (uint64_t i = 0; i < _SD_PATH_MAX; i++) {
_cleanup_strv_free_ char **t = NULL, **s = NULL;
- char **item;
int r;
r = sd_path_lookup_strv(i, NULL, &t);
#include "virt.h"
static int find_netcat_executable(char **ret_path) {
- char **candidates = STRV_MAKE("ncat", "nc", "netcat"), **c;
+ char **candidates = STRV_MAKE("ncat", "nc", "netcat");
int r = 0;
STRV_FOREACH(c, candidates) {
_cleanup_free_ char *exec_start = NULL;
_cleanup_(unit_freep) Unit *u = NULL;
CGroupContext *cc = NULL;
- char **rule;
int cld_code, r;
assert_se(u = unit_new(m, sizeof(Service)));
"124",
NULL,
};
- const char * const *p, * const *q;
STRV_FOREACH(p, versions)
STRV_FOREACH(q, p + 1)
_cleanup_strv_free_ char **s;
_cleanup_free_ char *j;
unsigned i = 0;
- char **t;
int r;
log_info("/* %s */", __func__);
TEST(strv_split_newlines) {
unsigned i = 0;
- char **s;
_cleanup_strv_free_ char **l = NULL;
const char str[] = "one\ntwo\nthree";
TEST(strv_foreach) {
_cleanup_strv_free_ char **a;
unsigned i = 0;
- char **check;
a = strv_new("one", "two", "three");
assert_se(a);
TEST(strv_foreach_backwards) {
_cleanup_strv_free_ char **a;
unsigned i = 2;
- char **check;
a = strv_new("one", "two", "three");
TEST(strv_foreach_pair) {
_cleanup_strv_free_ char **a = NULL;
- char **x, **y;
a = strv_new("pair_one", "pair_one",
"pair_two", "pair_two",
};
TEST(sysctl_normalize) {
- const char **s, **expected;
STRV_FOREACH_PAIR(s, expected, (const char**) cases) {
_cleanup_free_ char *t;
TEST(get_timezones) {
_cleanup_strv_free_ char **zones = NULL;
int r;
- char **zone;
r = get_timezones(&zones);
assert_se(r == 0);
if (r == 0)
log_debug("Cache rebuild skipped based on mtime.");
- char **id;
STRV_FOREACH(id, ids) {
const char *fragment, *name;
_cleanup_set_free_free_ Set *names = NULL;
static int context_parse_ntp_services_from_disk(Context *c) {
_cleanup_strv_free_ char **files = NULL;
- char **f;
int r;
r = conf_files_list_strv(&files, ".list", NULL, CONF_FILES_FILTER_MASKED, UNIT_LIST_DIRS);
static int manager_network_read_link_servers(Manager *m) {
_cleanup_strv_free_ char **ntp = NULL;
- char **i;
bool changed = false;
int r;
}
static int fd_set_xattrs(Item *i, int fd, const char *path, const struct stat *st) {
- char **name, **value;
-
assert(i);
assert(fd >= 0);
assert(path);
.gl_opendir = (void *(*)(const char *)) opendir_nomod,
};
int r = 0, k;
- char **fn;
k = safe_glob(i->path, GLOB_NOSORT|GLOB_BRACE, &g);
if (k < 0 && k != -ENOENT)
.gl_opendir = (void *(*)(const char *)) opendir_nomod,
};
int r = 0, k;
- char **fn;
k = safe_glob(i->path, GLOB_NOSORT|GLOB_BRACE, &g);
if (k < 0 && k != -ENOENT)
}
static bool should_include_path(const char *path) {
- char **prefix;
-
STRV_FOREACH(prefix, arg_exclude_prefixes)
if (path_startswith(path, *prefix)) {
log_debug("Entry \"%s\" matches exclude prefix \"%s\", skipping.",
return free_and_replace(i->argument, resolved);
}
case SET_XATTR:
- case RECURSIVE_SET_XATTR: {
- char **xattr;
+ case RECURSIVE_SET_XATTR:
STRV_FOREACH(xattr, i->xattrs) {
_cleanup_free_ char *resolved = NULL;
free_and_replace(*xattr, resolved);
}
return 0;
- }
+
default:
return 0;
}
}
static int parse_arguments(char **config_dirs, char **args, bool *invalid_config) {
- char **arg;
int r;
STRV_FOREACH(arg, args) {
static int read_config_files(char **config_dirs, char **args, bool *invalid_config) {
_cleanup_strv_free_ char **files = NULL;
_cleanup_free_ char *p = NULL;
- char **f;
int r;
r = conf_files_list_with_replacement(arg_root, config_dirs, arg_replace, &files, &p);
if (DEBUG_LOGGING) {
_cleanup_free_ char *t = NULL;
- char **i;
STRV_FOREACH(i, config_dirs) {
_cleanup_free_ char *j = NULL;
union sockaddr_union sa;
socklen_t sa_len;
size_t packet_length = 1;
- char **p, *d;
+ char *d;
ssize_t n;
int r;
if (r < 0)
return r;
if (r == 0) {
- char **i;
-
assert_se(prctl(PR_SET_PDEATHSIG, SIGHUP) >= 0);
STRV_FOREACH(i, arguments) {
_cleanup_set_free_ Set *pids = NULL;
_cleanup_strv_free_ char **consoles = NULL, **arguments = NULL;
siginfo_t status = {};
- char **tty;
pid_t pid;
int r;
int link_config_load(LinkConfigContext *ctx) {
_cleanup_strv_free_ char **files = NULL;
- char **f;
int r;
link_configs_free(ctx);
if (r < 0)
log_link_debug_errno(link, r, "Failed to get alternative names, ignoring: %m");
- char **p;
STRV_FOREACH(p, current_altnames)
strv_remove(altnames, *p);
/* Log output only if we watch stderr. */
if (l > 0 && spawn->fd_stderr >= 0) {
_cleanup_strv_free_ char **v = NULL;
- char **q;
r = strv_split_newlines_full(&v, p, EXTRACT_RETAIN_ESCAPE);
if (r < 0)
int udev_rules_load(UdevRules **ret_rules, ResolveNameTiming resolve_name_timing) {
_cleanup_(udev_rules_freep) UdevRules *rules = NULL;
_cleanup_strv_free_ char **files = NULL;
- char **f;
int r;
rules = udev_rules_new(resolve_name_timing);
}
case TK_M_IMPORT_PROGRAM: {
_cleanup_strv_free_ char **lines = NULL;
- char buf[UDEV_PATH_SIZE], result[UDEV_LINE_SIZE], **line;
+ char buf[UDEV_PATH_SIZE], result[UDEV_LINE_SIZE];
bool truncated;
(void) udev_event_apply_format(event, token->value, buf, sizeof(buf), false, &truncated);
char device_node[UDEV_PATH_SIZE], tags_dir[UDEV_PATH_SIZE], tag_symlink[UDEV_PATH_SIZE];
_cleanup_free_ char *unescaped_filename = NULL;
struct stat stats;
- char **t;
int r;
assert(devnode);
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"-x/--export or -P/--export-prefix cannot be used with --value");
- char **p;
STRV_FOREACH(p, devices) {
_cleanup_(sd_device_unrefp) sd_device *device = NULL;
(void) table_set_display(table, (size_t) 0, (size_t) 1, (size_t) 2, (size_t) 3, (size_t) 4, (size_t) 5, (size_t) 6, (size_t) 7);
}
- if (argc > 1) {
- char **i;
-
+ if (argc > 1)
STRV_FOREACH(i, argv + 1) {
_cleanup_(user_record_unrefp) UserRecord *ur = NULL;
uid_t uid;
draw_separator = true;
}
}
- } else {
+ else {
_cleanup_(userdb_iterator_freep) UserDBIterator *iterator = NULL;
r = userdb_all(arg_userdb_flags, &iterator);
(void) table_set_display(table, (size_t) 0, (size_t) 1, (size_t) 2, (size_t) 3, (size_t) 4);
}
- if (argc > 1) {
- char **i;
-
+ if (argc > 1)
STRV_FOREACH(i, argv + 1) {
_cleanup_(group_record_unrefp) GroupRecord *gr = NULL;
gid_t gid;
draw_separator = true;
}
}
-
- } else {
+ else {
_cleanup_(userdb_iterator_freep) UserDBIterator *iterator = NULL;
r = groupdb_all(arg_userdb_flags, &iterator);
(void) table_set_sort(table, (size_t) 0, (size_t) 1);
}
- if (argc > 1) {
- char **i;
-
+ if (argc > 1)
STRV_FOREACH(i, argv + 1) {
_cleanup_(userdb_iterator_freep) UserDBIterator *iterator = NULL;
return r;
}
}
- } else {
+ else {
_cleanup_(userdb_iterator_freep) UserDBIterator *iterator = NULL;
r = membershipdb_all(arg_userdb_flags, &iterator);
else {
if (strv_isempty(ur->ssh_authorized_keys))
log_debug("User record for %s has no public SSH keys.", argv[1]);
- else {
- char **i;
-
+ else
STRV_FOREACH(i, ur->ssh_authorized_keys)
printf("%s\n", *i);
- }
if (ur->incomplete) {
fflush(stdout);
static int run(int argc, char *argv[]) {
_cleanup_strv_free_ char **only_show_in = NULL, **not_show_in = NULL, **desktops = NULL;
const char *xdg_current_desktop;
- char **d;
if (argc != 3)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
_cleanup_strv_free_ char **config_dirs = NULL;
_unused_ _cleanup_strv_free_ char **data_dirs = NULL;
_cleanup_free_ char *user_config_autostart_dir = NULL;
- char **path;
int r;
r = xdg_user_config_dir(&user_config_autostart_dir, "/autostart");