* systemctl status $PID, systemctl stop $PID!
-/dev/null symlinks supporten
-
* place /etc/inittab with explaining blurb.
* /etc must always take precedence even if we follow symlinks!
path_kill_slashes(*filename);
/* Add the file name we are currently looking at to
- * the names of this unit */
+ * the names of this unit, but only if it is a valid
+ * unit name. */
name = file_name_from_path(*filename);
- if (!(id = set_get(names, name))) {
- if (!(id = strdup(name)))
- return -ENOMEM;
+ if (unit_name_is_valid(name)) {
+ if (!(id = set_get(names, name))) {
- if ((r = set_put(names, id)) < 0) {
- free(id);
- return r;
+ if (!(id = strdup(name)))
+ return -ENOMEM;
+
+ if ((r = set_put(names, id)) < 0) {
+ free(id);
+ return r;
+ }
}
}
*filename = target;
}
- if (!(f = fdopen(fd, "r"))) {
+ if (!(f = fdopen(fd, "re"))) {
r = -errno;
close_nointr_nofail(fd);
return r;
}
if (!filename) {
+ /* Hmm, no suitable file found? */
r = 0;
goto finish;
}
goto finish;
}
- if (!S_ISREG(st.st_mode)) {
- r = -ENOENT;
- goto finish;
- }
-
/* Now, parse the file contents */
if ((r = config_parse(filename, f, sections, items, false, u)) < 0)
goto finish;