From 1a5a177eafa72adfd40916be05f35b71011014b0 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 23 Mar 2018 21:31:14 +0100 Subject: [PATCH] fileio: accept FILE* in addition to path in parse_env_file() Most our other parsing functions do this, let's do this here too, internally we accept that anyway. Also, the closely related load_env_file() and load_env_file_pairs() also do this, so let's be systematic. --- src/basic/fileio.c | 3 ++- src/basic/fileio.h | 2 +- src/basic/util.c | 2 +- src/core/locale-setup.c | 4 ++-- src/core/main.c | 2 +- src/firstboot/firstboot.c | 4 ++-- src/hostname/hostnamed.c | 6 +++--- src/journal-remote/journal-gatewayd.c | 4 ++-- src/journal-remote/journal-upload.c | 2 +- src/journal/journald-stream.c | 2 +- src/journal/sd-journal.c | 2 +- src/libsystemd-network/sd-dhcp-lease.c | 2 +- src/libsystemd/sd-login/sd-login.c | 28 +++++++++++++------------- src/libsystemd/sd-network/sd-network.c | 10 ++++----- src/locale/keymap-util.c | 4 ++-- src/locale/localectl.c | 2 +- src/login/logind-inhibit.c | 2 +- src/login/logind-session.c | 2 +- src/login/logind-user.c | 2 +- src/machine/machine.c | 2 +- src/network/networkd-link.c | 2 +- src/network/networkd-lldp-tx.c | 2 +- src/resolve/resolved-link.c | 2 +- src/shared/cgroup-show.c | 2 +- src/shared/condition.c | 2 +- src/shared/udev-util.c | 2 +- src/systemctl/systemctl.c | 2 +- src/test/test-fileio.c | 2 +- src/vconsole/vconsole-setup.c | 4 ++-- 29 files changed, 54 insertions(+), 53 deletions(-) diff --git a/src/basic/fileio.c b/src/basic/fileio.c index 5cab4c1024..375d6fd5b3 100644 --- a/src/basic/fileio.c +++ b/src/basic/fileio.c @@ -677,6 +677,7 @@ static int parse_env_file_push( } int parse_env_file( + FILE *f, const char *fname, const char *newline, ...) { @@ -687,7 +688,7 @@ int parse_env_file( newline = NEWLINE; va_start(ap, newline); - r = parse_env_file_internal(NULL, fname, newline, parse_env_file_push, &ap, &n_pushed); + r = parse_env_file_internal(f, fname, newline, parse_env_file_push, &ap, &n_pushed); va_end(ap); return r < 0 ? r : n_pushed; diff --git a/src/basic/fileio.h b/src/basic/fileio.h index bed7c8fb7e..6be261ba0b 100644 --- a/src/basic/fileio.h +++ b/src/basic/fileio.h @@ -45,7 +45,7 @@ int read_full_stream(FILE *f, char **contents, size_t *size); int verify_file(const char *fn, const char *blob, bool accept_extra_nl); -int parse_env_file(const char *fname, const char *separator, ...) _sentinel_; +int parse_env_file(FILE *f, const char *fname, const char *separator, ...) _sentinel_; int load_env_file(FILE *f, const char *fname, const char *separator, char ***l); int load_env_file_pairs(FILE *f, const char *fname, const char *separator, char ***l); diff --git a/src/basic/util.c b/src/basic/util.c index 68aaa21a8d..d158089538 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -264,7 +264,7 @@ int container_get_leader(const char *machine, pid_t *pid) { return -EINVAL; p = strjoina("/run/systemd/machines/", machine); - r = parse_env_file(p, NEWLINE, "LEADER", &s, "CLASS", &class, NULL); + r = parse_env_file(NULL, p, NEWLINE, "LEADER", &s, "CLASS", &class, NULL); if (r == -ENOENT) return -EHOSTDOWN; if (r < 0) diff --git a/src/core/locale-setup.c b/src/core/locale-setup.c index 705dd95de1..dcb70d6fe3 100644 --- a/src/core/locale-setup.c +++ b/src/core/locale-setup.c @@ -24,7 +24,7 @@ int locale_setup(char ***environment) { int r = 0, i; if (detect_container() <= 0) { - r = parse_env_file("/proc/cmdline", WHITESPACE, + r = parse_env_file(NULL, "/proc/cmdline", WHITESPACE, "locale.LANG", &variables[VARIABLE_LANG], "locale.LANGUAGE", &variables[VARIABLE_LANGUAGE], "locale.LC_CTYPE", &variables[VARIABLE_LC_CTYPE], @@ -48,7 +48,7 @@ int locale_setup(char ***environment) { /* Hmm, nothing set on the kernel cmd line? Then let's * try /etc/locale.conf */ if (r <= 0) { - r = parse_env_file("/etc/locale.conf", NEWLINE, + r = parse_env_file(NULL, "/etc/locale.conf", NEWLINE, "LANG", &variables[VARIABLE_LANG], "LANGUAGE", &variables[VARIABLE_LANGUAGE], "LC_CTYPE", &variables[VARIABLE_LC_CTYPE], diff --git a/src/core/main.c b/src/core/main.c index d70c1b8160..e7d89be3f4 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1222,7 +1222,7 @@ static int status_welcome(void) { return 0; FOREACH_STRING(fn, "/etc/os-release", "/usr/lib/os-release") { - r = parse_env_file(fn, NEWLINE, + r = parse_env_file(NULL, fn, NEWLINE, "PRETTY_NAME", &pretty_name, "ANSI_COLOR", &ansi_color, NULL); diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c index 7895e3832a..9b091bf87a 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -87,13 +87,13 @@ static void print_welcome(void) { return; os_release = prefix_roota(arg_root, "/etc/os-release"); - r = parse_env_file(os_release, NEWLINE, + r = parse_env_file(NULL, os_release, NEWLINE, "PRETTY_NAME", &pretty_name, NULL); if (r == -ENOENT) { os_release = prefix_roota(arg_root, "/usr/lib/os-release"); - r = parse_env_file(os_release, NEWLINE, + r = parse_env_file(NULL, os_release, NEWLINE, "PRETTY_NAME", &pretty_name, NULL); } diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index 88a8938c31..db54e472c6 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -88,7 +88,7 @@ static int context_read_data(Context *c) { if (r < 0 && r != -ENOENT) return r; - r = parse_env_file("/etc/machine-info", NEWLINE, + r = parse_env_file(NULL, "/etc/machine-info", NEWLINE, "PRETTY_HOSTNAME", &c->data[PROP_PRETTY_HOSTNAME], "ICON_NAME", &c->data[PROP_ICON_NAME], "CHASSIS", &c->data[PROP_CHASSIS], @@ -98,13 +98,13 @@ static int context_read_data(Context *c) { if (r < 0 && r != -ENOENT) return r; - r = parse_env_file("/etc/os-release", NEWLINE, + r = parse_env_file(NULL, "/etc/os-release", NEWLINE, "PRETTY_NAME", &c->data[PROP_OS_PRETTY_NAME], "CPE_NAME", &c->data[PROP_OS_CPE_NAME], "HOME_URL", &c->data[PROP_HOME_URL], NULL); if (r == -ENOENT) - r = parse_env_file("/usr/lib/os-release", NEWLINE, + r = parse_env_file(NULL, "/usr/lib/os-release", NEWLINE, "PRETTY_NAME", &c->data[PROP_OS_PRETTY_NAME], "CPE_NAME", &c->data[PROP_OS_CPE_NAME], "HOME_URL", &c->data[PROP_HOME_URL], diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index 7399d3315f..f80ca7e671 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -777,8 +777,8 @@ static int request_handler_machine( if (r < 0) return mhd_respondf(connection, r, MHD_HTTP_INTERNAL_SERVER_ERROR, "Failed to determine disk usage: %m"); - if (parse_env_file("/etc/os-release", NEWLINE, "PRETTY_NAME", &os_name, NULL) == -ENOENT) - (void) parse_env_file("/usr/lib/os-release", NEWLINE, "PRETTY_NAME", &os_name, NULL); + if (parse_env_file(NULL, "/etc/os-release", NEWLINE, "PRETTY_NAME", &os_name, NULL) == -ENOENT) + (void) parse_env_file(NULL, "/usr/lib/os-release", NEWLINE, "PRETTY_NAME", &os_name, NULL); get_virtualization(&v); diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index 5194b3136f..4a351079e9 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -152,7 +152,7 @@ static int load_cursor_state(Uploader *u) { if (!u->state_file) return 0; - r = parse_env_file(u->state_file, NEWLINE, + r = parse_env_file(NULL, u->state_file, NEWLINE, "LAST_CURSOR", &u->last_cursor, NULL); diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c index 35c664455e..93a0cc2288 100644 --- a/src/journal/journald-stream.c +++ b/src/journal/journald-stream.c @@ -646,7 +646,7 @@ static int stdout_stream_load(StdoutStream *stream, const char *fname) { return log_oom(); } - r = parse_env_file(stream->state_file, NEWLINE, + r = parse_env_file(NULL, stream->state_file, NEWLINE, "PRIORITY", &priority, "LEVEL_PREFIX", &level_prefix, "FORWARD_TO_SYSLOG", &forward_to_syslog, diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index 2e81799add..7d81790356 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -1894,7 +1894,7 @@ _public_ int sd_journal_open_container(sd_journal **ret, const char *machine, in assert_return(machine_name_is_valid(machine), -EINVAL); p = strjoina("/run/systemd/machines/", machine); - r = parse_env_file(p, NEWLINE, "ROOT", &root, "CLASS", &class, NULL); + r = parse_env_file(NULL, p, NEWLINE, "ROOT", &root, "CLASS", &class, NULL); if (r == -ENOENT) return -EHOSTDOWN; if (r < 0) diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c index 505d02b50d..5bc7454957 100644 --- a/src/libsystemd-network/sd-dhcp-lease.c +++ b/src/libsystemd-network/sd-dhcp-lease.c @@ -1034,7 +1034,7 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) { if (r < 0) return r; - r = parse_env_file(lease_file, NEWLINE, + r = parse_env_file(NULL, lease_file, NEWLINE, "ADDRESS", &address, "ROUTER", &router, "NETMASK", &netmask, diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c index 3f73dadc2e..fdbc29cc38 100644 --- a/src/libsystemd/sd-login/sd-login.c +++ b/src/libsystemd/sd-login/sd-login.c @@ -273,7 +273,7 @@ _public_ int sd_uid_get_state(uid_t uid, char**state) { if (r < 0) return r; - r = parse_env_file(p, NEWLINE, "STATE", &s, NULL); + r = parse_env_file(NULL, p, NEWLINE, "STATE", &s, NULL); if (r == -ENOENT) { free(s); s = strdup("offline"); @@ -304,7 +304,7 @@ _public_ int sd_uid_get_display(uid_t uid, char **session) { if (r < 0) return r; - r = parse_env_file(p, NEWLINE, "DISPLAY", &s, NULL); + r = parse_env_file(NULL, p, NEWLINE, "DISPLAY", &s, NULL); if (r == -ENOENT) return -ENODATA; if (r < 0) @@ -359,7 +359,7 @@ _public_ int sd_uid_is_on_seat(uid_t uid, int require_active, const char *seat) variable = require_active ? "ACTIVE_UID" : "UIDS"; - r = parse_env_file(p, NEWLINE, variable, &s, NULL); + r = parse_env_file(NULL, p, NEWLINE, variable, &s, NULL); if (r == -ENOENT) return 0; if (r < 0) @@ -388,7 +388,7 @@ static int uid_get_array(uid_t uid, const char *variable, char ***array) { if (r < 0) return r; - r = parse_env_file(p, NEWLINE, variable, &s, NULL); + r = parse_env_file(NULL, p, NEWLINE, variable, &s, NULL); if (r == -ENOENT || (r >= 0 && isempty(s))) { if (array) *array = NULL; @@ -466,7 +466,7 @@ _public_ int sd_session_is_active(const char *session) { if (r < 0) return r; - r = parse_env_file(p, NEWLINE, "ACTIVE", &s, NULL); + r = parse_env_file(NULL, p, NEWLINE, "ACTIVE", &s, NULL); if (r == -ENOENT) return -ENXIO; if (r < 0) @@ -485,7 +485,7 @@ _public_ int sd_session_is_remote(const char *session) { if (r < 0) return r; - r = parse_env_file(p, NEWLINE, "REMOTE", &s, NULL); + r = parse_env_file(NULL, p, NEWLINE, "REMOTE", &s, NULL); if (r == -ENOENT) return -ENXIO; if (r < 0) @@ -506,7 +506,7 @@ _public_ int sd_session_get_state(const char *session, char **state) { if (r < 0) return r; - r = parse_env_file(p, NEWLINE, "STATE", &s, NULL); + r = parse_env_file(NULL, p, NEWLINE, "STATE", &s, NULL); if (r == -ENOENT) return -ENXIO; if (r < 0) @@ -529,7 +529,7 @@ _public_ int sd_session_get_uid(const char *session, uid_t *uid) { if (r < 0) return r; - r = parse_env_file(p, NEWLINE, "UID", &s, NULL); + r = parse_env_file(NULL, p, NEWLINE, "UID", &s, NULL); if (r == -ENOENT) return -ENXIO; if (r < 0) @@ -551,7 +551,7 @@ static int session_get_string(const char *session, const char *field, char **val if (r < 0) return r; - r = parse_env_file(p, NEWLINE, field, &s, NULL); + r = parse_env_file(NULL, p, NEWLINE, field, &s, NULL); if (r == -ENOENT) return -ENXIO; if (r < 0) @@ -643,7 +643,7 @@ _public_ int sd_seat_get_active(const char *seat, char **session, uid_t *uid) { if (r < 0) return r; - r = parse_env_file(p, NEWLINE, + r = parse_env_file(NULL, p, NEWLINE, "ACTIVE", &s, "ACTIVE_UID", &t, NULL); @@ -681,7 +681,7 @@ _public_ int sd_seat_get_sessions(const char *seat, char ***sessions, uid_t **ui if (r < 0) return r; - r = parse_env_file(p, NEWLINE, + r = parse_env_file(NULL, p, NEWLINE, "SESSIONS", &s, "UIDS", &t, NULL); @@ -750,7 +750,7 @@ static int seat_get_can(const char *seat, const char *variable) { if (r < 0) return r; - r = parse_env_file(p, NEWLINE, + r = parse_env_file(NULL, p, NEWLINE, variable, &s, NULL); if (r == -ENOENT) @@ -899,7 +899,7 @@ _public_ int sd_machine_get_class(const char *machine, char **class) { assert_return(class, -EINVAL); p = strjoina("/run/systemd/machines/", machine); - r = parse_env_file(p, NEWLINE, "CLASS", &c, NULL); + r = parse_env_file(NULL, p, NEWLINE, "CLASS", &c, NULL); if (r == -ENOENT) return -ENXIO; if (r < 0) @@ -923,7 +923,7 @@ _public_ int sd_machine_get_ifindices(const char *machine, int **ifindices) { assert_return(ifindices, -EINVAL); p = strjoina("/run/systemd/machines/", machine); - r = parse_env_file(p, NEWLINE, "NETIF", &netif, NULL); + r = parse_env_file(NULL, p, NEWLINE, "NETIF", &netif, NULL); if (r == -ENOENT) return -ENXIO; if (r < 0) diff --git a/src/libsystemd/sd-network/sd-network.c b/src/libsystemd/sd-network/sd-network.c index 286e92bc2c..4f3f6f9e1d 100644 --- a/src/libsystemd/sd-network/sd-network.c +++ b/src/libsystemd/sd-network/sd-network.c @@ -30,7 +30,7 @@ _public_ int sd_network_get_operational_state(char **state) { assert_return(state, -EINVAL); - r = parse_env_file("/run/systemd/netif/state", NEWLINE, "OPER_STATE", &s, NULL); + r = parse_env_file(NULL, "/run/systemd/netif/state", NEWLINE, "OPER_STATE", &s, NULL); if (r == -ENOENT) return -ENODATA; if (r < 0) @@ -50,7 +50,7 @@ static int network_get_strv(const char *key, char ***ret) { assert_return(ret, -EINVAL); - r = parse_env_file("/run/systemd/netif/state", NEWLINE, key, &s, NULL); + r = parse_env_file(NULL, "/run/systemd/netif/state", NEWLINE, key, &s, NULL); if (r == -ENOENT) return -ENODATA; if (r < 0) @@ -98,7 +98,7 @@ static int network_link_get_string(int ifindex, const char *field, char **ret) { xsprintf(path, "/run/systemd/netif/links/%i", ifindex); - r = parse_env_file(path, NEWLINE, field, &s, NULL); + r = parse_env_file(NULL, path, NEWLINE, field, &s, NULL); if (r == -ENOENT) return -ENODATA; if (r < 0) @@ -121,7 +121,7 @@ static int network_link_get_strv(int ifindex, const char *key, char ***ret) { assert_return(ret, -EINVAL); xsprintf(path, "/run/systemd/netif/links/%i", ifindex); - r = parse_env_file(path, NEWLINE, key, &s, NULL); + r = parse_env_file(NULL, path, NEWLINE, key, &s, NULL); if (r == -ENOENT) return -ENODATA; if (r < 0) @@ -218,7 +218,7 @@ static int network_link_get_ifindexes(int ifindex, const char *key, int **ret) { assert_return(ret, -EINVAL); xsprintf(path, "/run/systemd/netif/links/%i", ifindex); - r = parse_env_file(path, NEWLINE, key, &s, NULL); + r = parse_env_file(NULL, path, NEWLINE, key, &s, NULL); if (r == -ENOENT) return -ENODATA; if (r < 0) diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c index 1aca627658..7cc2eb4407 100644 --- a/src/locale/keymap-util.c +++ b/src/locale/keymap-util.c @@ -93,7 +93,7 @@ static int locale_read_data(Context *c) { context_free_locale(c); - r = parse_env_file("/etc/locale.conf", NEWLINE, + r = parse_env_file(NULL, "/etc/locale.conf", NEWLINE, "LANG", &c->locale[VARIABLE_LANG], "LANGUAGE", &c->locale[VARIABLE_LANGUAGE], "LC_CTYPE", &c->locale[VARIABLE_LC_CTYPE], @@ -137,7 +137,7 @@ static int vconsole_read_data(Context *c) { context_free_vconsole(c); - r = parse_env_file("/etc/vconsole.conf", NEWLINE, + r = parse_env_file(NULL, "/etc/vconsole.conf", NEWLINE, "KEYMAP", &c->vc_keymap, "KEYMAP_TOGGLE", &c->vc_keymap_toggle, NULL); diff --git a/src/locale/localectl.c b/src/locale/localectl.c index 473b28de4d..49a44ae8bb 100644 --- a/src/locale/localectl.c +++ b/src/locale/localectl.c @@ -61,7 +61,7 @@ static void print_overridden_variables(void) { if (detect_container() > 0 || arg_host) return; - r = parse_env_file("/proc/cmdline", WHITESPACE, + r = parse_env_file(NULL, "/proc/cmdline", WHITESPACE, "locale.LANG", &variables[VARIABLE_LANG], "locale.LANGUAGE", &variables[VARIABLE_LANGUAGE], "locale.LC_CTYPE", &variables[VARIABLE_LC_CTYPE], diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c index 0938f2f101..8bf3e72d22 100644 --- a/src/login/logind-inhibit.c +++ b/src/login/logind-inhibit.c @@ -198,7 +198,7 @@ int inhibitor_load(Inhibitor *i) { char *cc; int r; - r = parse_env_file(i->state_file, NEWLINE, + r = parse_env_file(NULL, i->state_file, NEWLINE, "WHAT", &what, "UID", &uid, "PID", &pid, diff --git a/src/login/logind-session.c b/src/login/logind-session.c index eb131ae50c..a82498c92e 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -365,7 +365,7 @@ int session_load(Session *s) { assert(s); - r = parse_env_file(s->state_file, NEWLINE, + r = parse_env_file(NULL, s->state_file, NEWLINE, "REMOTE", &remote, "SCOPE", &s->scope, "SCOPE_JOB", &s->scope_job, diff --git a/src/login/logind-user.c b/src/login/logind-user.c index 8d3af6948c..1dfc590147 100644 --- a/src/login/logind-user.c +++ b/src/login/logind-user.c @@ -287,7 +287,7 @@ int user_load(User *u) { assert(u); - r = parse_env_file(u->state_file, NEWLINE, + r = parse_env_file(NULL, u->state_file, NEWLINE, "SERVICE_JOB", &u->service_job, "SLICE_JOB", &u->slice_job, "DISPLAY", &display, diff --git a/src/machine/machine.c b/src/machine/machine.c index 008bbbc3f4..f57984a0c2 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -255,7 +255,7 @@ int machine_load(Machine *m) { if (!m->state_file) return 0; - r = parse_env_file(m->state_file, NEWLINE, + r = parse_env_file(NULL, m->state_file, NEWLINE, "SCOPE", &m->unit, "SCOPE_JOB", &m->scope_job, "SERVICE", &m->service, diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index be0742e47b..8cc817ac00 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -2866,7 +2866,7 @@ static int link_load(Link *link) { assert(link); - r = parse_env_file(link->state_file, NEWLINE, + r = parse_env_file(NULL, link->state_file, NEWLINE, "NETWORK_FILE", &network_file, "ADDRESSES", &addresses, "ROUTES", &routes, diff --git a/src/network/networkd-lldp-tx.c b/src/network/networkd-lldp-tx.c index 6cccfc4be0..a2121eb5ff 100644 --- a/src/network/networkd-lldp-tx.c +++ b/src/network/networkd-lldp-tx.c @@ -249,7 +249,7 @@ static int link_send_lldp(Link *link) { return r; (void) gethostname_strict(&hostname); - (void) parse_env_file("/etc/machine-info", NEWLINE, "PRETTY_HOSTNAME", &pretty_hostname, NULL); + (void) parse_env_file(NULL, "/etc/machine-info", NEWLINE, "PRETTY_HOSTNAME", &pretty_hostname, NULL); assert_cc(LLDP_TX_INTERVAL_USEC * LLDP_TX_HOLD + 1 <= (UINT16_MAX - 1) * USEC_PER_SEC); ttl = DIV_ROUND_UP(LLDP_TX_INTERVAL_USEC * LLDP_TX_HOLD + 1, USEC_PER_SEC); diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c index f2552a11de..a0eedd86d3 100644 --- a/src/resolve/resolved-link.c +++ b/src/resolve/resolved-link.c @@ -1202,7 +1202,7 @@ int link_load_user(Link *l) { if (l->is_managed) return 0; /* if the device is managed, then networkd is our configuration source, not the bus API */ - r = parse_env_file(l->state_file, NEWLINE, + r = parse_env_file(NULL, l->state_file, NEWLINE, "LLMNR", &llmnr, "MDNS", &mdns, "DNSSEC", &dnssec, diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c index ea2db32510..4db638a874 100644 --- a/src/shared/cgroup-show.c +++ b/src/shared/cgroup-show.c @@ -344,7 +344,7 @@ int show_cgroup_get_path_and_warn( const char *m; m = strjoina("/run/systemd/machines/", machine); - r = parse_env_file(m, NEWLINE, "SCOPE", &unit, NULL); + r = parse_env_file(NULL, m, NEWLINE, "SCOPE", &unit, NULL); if (r < 0) return log_error_errno(r, "Failed to load machine data: %m"); diff --git a/src/shared/condition.c b/src/shared/condition.c index 87e8a485ff..bf6476c339 100644 --- a/src/shared/condition.c +++ b/src/shared/condition.c @@ -464,7 +464,7 @@ static int condition_test_needs_update(Condition *c) { uint64_t timestamp; int r; - r = parse_env_file(p, NULL, "TIMESTAMP_NSEC", ×tamp_str, NULL); + r = parse_env_file(NULL, p, NULL, "TIMESTAMP_NSEC", ×tamp_str, NULL); if (r < 0) { log_error_errno(r, "Failed to parse timestamp file '%s', using mtime: %m", p); return true; diff --git a/src/shared/udev-util.c b/src/shared/udev-util.c index cd2e38533f..29484226c6 100644 --- a/src/shared/udev-util.c +++ b/src/shared/udev-util.c @@ -18,7 +18,7 @@ int udev_parse_config(void) { size_t n; int r; - r = parse_env_file("/etc/udev/udev.conf", NEWLINE, "udev_log", &val, NULL); + r = parse_env_file(NULL, "/etc/udev/udev.conf", NEWLINE, "udev_log", &val, NULL); if (r == -ENOENT || !val) return 0; if (r < 0) diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index fcc6c08492..60861dd791 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -5664,7 +5664,7 @@ static int switch_root(int argc, char *argv[], void *userdata) { if (argc >= 3) init = argv[2]; else { - r = parse_env_file("/proc/cmdline", WHITESPACE, + r = parse_env_file(NULL, "/proc/cmdline", WHITESPACE, "init", &cmdline_init, NULL); if (r < 0) diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c index bbddbf3bcd..3476c41291 100644 --- a/src/test/test-fileio.c +++ b/src/test/test-fileio.c @@ -95,7 +95,7 @@ static void test_parse_env_file(void) { } r = parse_env_file( - t, NULL, + NULL, t, NULL, "one", &one, "two", &two, "three", &three, diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c index 9cda56e916..6bf773a1ed 100644 --- a/src/vconsole/vconsole-setup.c +++ b/src/vconsole/vconsole-setup.c @@ -420,7 +420,7 @@ int main(int argc, char **argv) { utf8 = is_locale_utf8(); - r = parse_env_file("/etc/vconsole.conf", NEWLINE, + r = parse_env_file(NULL, "/etc/vconsole.conf", NEWLINE, "KEYMAP", &vc_keymap, "KEYMAP_TOGGLE", &vc_keymap_toggle, "FONT", &vc_font, @@ -432,7 +432,7 @@ int main(int argc, char **argv) { /* Let the kernel command line override /etc/vconsole.conf */ if (detect_container() <= 0) { - r = parse_env_file("/proc/cmdline", WHITESPACE, + r = parse_env_file(NULL, "/proc/cmdline", WHITESPACE, "vconsole.keymap", &vc_keymap, "vconsole.keymap_toggle", &vc_keymap_toggle, "vconsole.font", &vc_font,