If you enter unit_add_exec_dependencies with m->where = NULL, you'll
very likely end up aborting somewhere under socket_needs_mount.
(When systemd goes to check to see if the journald socket requires your
mount, it'll do path_startswith(path, m->where)... *kaboom*)
This patch should ensure that:
a) both branches in mount_add_one() set m->where, and
b) mount_add_extras() calls unit_add_exec_dependencies() *after*
setting m->where.
Unit *u = UNIT(m);
int r;
- r = unit_add_exec_dependencies(u, &m->exec_context);
- if (r < 0)
- return r;
-
if (UNIT(m)->fragment_path)
m->from_fragment = true;
path_kill_slashes(m->where);
+ r = unit_add_exec_dependencies(u, &m->exec_context);
+ if (r < 0)
+ return r;
+
if (!UNIT(m)->description) {
r = unit_set_description(u, m->where);
if (r < 0)
delete = false;
free(e);
+ if (!MOUNT(u)->where) {
+ MOUNT(u)->where = strdup(where);
+ if (!MOUNT(u)->where) {
+ r = -ENOMEM;
+ goto fail;
+ }
+ }
+
if (u->load_state == UNIT_ERROR) {
u->load_state = UNIT_LOADED;
u->load_error = 0;