summaryrefslogtreecommitdiff
path: root/src/core/mount.c
diff options
context:
space:
mode:
authorUmut Tezduyar <umut@tezduyar.com>2013-02-07 09:06:20 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-02-14 15:26:34 -0500
commit47a81ba2e101058459328d2da3d9b950a8030c86 (patch)
tree45df8d820a49a974ebd887c0dfb02dbf0b0966ad /src/core/mount.c
parentf6bb13ab8db51aaedc825fec2f0458b60309b27a (diff)
core: do not overwrite existing units source
Only set source for freshly created .mounts coming from mountinfo file.
Diffstat (limited to 'src/core/mount.c')
-rw-r--r--src/core/mount.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/core/mount.c b/src/core/mount.c
index 2aaf78ceae..e3d298eb96 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1440,7 +1440,7 @@ static int mount_add_one(
int r;
Unit *u;
bool delete;
- char *e, *w = NULL, *o = NULL, *s = NULL, *f = NULL;
+ char *e, *w = NULL, *o = NULL, *f = NULL;
MountParameters *p;
bool load_extras = false;
@@ -1488,6 +1488,12 @@ static int mount_add_one(
goto fail;
}
+ u->source_path = strdup("/proc/self/mountinfo");
+ if (!u->source_path) {
+ r = -ENOMEM;
+ goto fail;
+ }
+
unit_add_to_load_queue(u);
} else {
delete = false;
@@ -1513,7 +1519,6 @@ static int mount_add_one(
if (!(w = strdup(what)) ||
!(o = strdup(options)) ||
- !(s = strdup("/proc/self/mountinfo")) ||
!(f = strdup(fstype))) {
r = -ENOMEM;
goto fail;
@@ -1527,8 +1532,6 @@ static int mount_add_one(
}
MOUNT(u)->from_proc_self_mountinfo = true;
- free(u->source_path);
- u->source_path = s;
free(p->what);
p->what = w;
@@ -1554,7 +1557,6 @@ static int mount_add_one(
fail:
free(w);
free(o);
- free(s);
free(f);
if (delete && u)