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.
This commit is contained in:
Lennart Poettering
2018-05-24 17:01:57 +02:00
parent e2047ba9ed
commit 1a5a177eaf
29 changed files with 54 additions and 53 deletions
+1 -1
View File
@@ -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");
+1 -1
View File
@@ -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", &timestamp_str, NULL);
r = parse_env_file(NULL, p, NULL, "TIMESTAMP_NSEC", &timestamp_str, NULL);
if (r < 0) {
log_error_errno(r, "Failed to parse timestamp file '%s', using mtime: %m", p);
return true;
+1 -1
View File
@@ -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)