mirror of
https://github.com/systemd/systemd
synced 2024-09-06 16:56:43 +00:00
sysusers: optionally, read sysuers configuration from standard input
This commit is contained in:
parent
d61bb44a89
commit
dfc87cbfe5
|
@ -75,7 +75,10 @@
|
|||
basename of a file is specified, all directories as
|
||||
specified in
|
||||
<citerefentry><refentrytitle>sysusers.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
||||
are searched for a matching file.</para>
|
||||
are searched for a matching file. If the string
|
||||
<filename>-</filename> is specified as filenames
|
||||
entries from the standard input of the process are
|
||||
read.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
|
|
|
@ -1573,14 +1573,18 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
|
|||
}
|
||||
|
||||
static int read_config_file(const char *fn, bool ignore_enoent) {
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
_cleanup_fclose_ FILE *rf = NULL;
|
||||
FILE *f = NULL;
|
||||
char line[LINE_MAX];
|
||||
unsigned v = 0;
|
||||
int r;
|
||||
|
||||
assert(fn);
|
||||
|
||||
r = search_and_fopen_nulstr(fn, "re", arg_root, conf_file_dirs, &f);
|
||||
if (streq(fn, "-"))
|
||||
f = stdin;
|
||||
else {
|
||||
r = search_and_fopen_nulstr(fn, "re", arg_root, conf_file_dirs, &rf);
|
||||
if (r < 0) {
|
||||
if (ignore_enoent && r == -ENOENT)
|
||||
return 0;
|
||||
|
@ -1589,6 +1593,9 @@ static int read_config_file(const char *fn, bool ignore_enoent) {
|
|||
return r;
|
||||
}
|
||||
|
||||
f = rf;
|
||||
}
|
||||
|
||||
FOREACH_LINE(line, f, break) {
|
||||
char *l;
|
||||
int k;
|
||||
|
|
Loading…
Reference in a new issue