diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-01-06 01:39:08 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-01-06 01:39:08 +0100 |
commit | afe4bfe2c1ed28a3e75c627edf458d2f40ff16f8 (patch) | |
tree | 836b7cef1b8562a7a36a5ed91444b7cd84fa7ef7 /src | |
parent | 06ac173943858b37980bee645329d4bb18dea47c (diff) |
fragment: allow prefixing of the EnvironmentFile= path with - to ignore errors
Diffstat (limited to 'src')
-rw-r--r-- | src/load-fragment.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/load-fragment.c b/src/load-fragment.c index 281863264e..334dd68146 100644 --- a/src/load-fragment.c +++ b/src/load-fragment.c @@ -1348,14 +1348,26 @@ static int config_parse_env_file( FILE *f; int r; char ***env = data; + bool ignore = false; assert(filename); assert(lvalue); assert(rvalue); assert(data); + if (rvalue[0] == '-') { + ignore = true; + rvalue++; + } + + if (!path_is_absolute(rvalue)) { + log_error("[%s:%u] Path '%s' is not absolute, ignoring.", filename, line, rvalue); + return 0; + } + if (!(f = fopen(rvalue, "re"))) { - log_error("[%s:%u] Failed to open environment file '%s', ignoring: %m", filename, line, rvalue); + if (!ignore) + log_error("[%s:%u] Failed to open environment file '%s', ignoring: %m", filename, line, rvalue); return 0; } |