summaryrefslogtreecommitdiff
path: root/src/load-fragment.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/load-fragment.c')
-rw-r--r--src/load-fragment.c14
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;
}