X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fload-fragment.c;h=740c11c3c2f3649d894bef523207c1cd0fd2df47;hp=1685c4adb76734a0d7f21687e55743a5c06e7020;hb=b9c0d4415b8cd6135321185b6febfdd1366a477c;hpb=f976f3f67ce5140dc0ba48e0c21a91a553905c57 diff --git a/src/load-fragment.c b/src/load-fragment.c index 1685c4adb..740c11c3c 100644 --- a/src/load-fragment.c +++ b/src/load-fragment.c @@ -1431,7 +1431,7 @@ static int open_follow(char **filename, FILE **_f, Set *names, char **_final) { * unit name. */ name = file_name_from_path(*filename); - if (unit_name_is_valid(name)) { + if (unit_name_is_valid(name, false)) { if (!(id = set_get(names, name))) { if (!(id = strdup(name))) @@ -1883,9 +1883,15 @@ static int load_from_path(Unit *u, const char *path) { goto finish; } - /* Now, parse the file contents */ - if ((r = config_parse(filename, f, sections, items, false, u)) < 0) - goto finish; + if (null_or_empty(&st)) + u->meta.load_state = UNIT_BANNED; + else { + /* Now, parse the file contents */ + if ((r = config_parse(filename, f, sections, items, false, u)) < 0) + goto finish; + + u->meta.load_state = UNIT_LOADED; + } free(u->meta.fragment_path); u->meta.fragment_path = filename; @@ -1893,7 +1899,6 @@ static int load_from_path(Unit *u, const char *path) { u->meta.fragment_mtime = timespec_load(&st.st_mtim); - u->meta.load_state = UNIT_LOADED; r = 0; finish: