fstab-gen: post can't be NULL

This commit is contained in:
Franck Bui 2015-11-25 21:21:44 +01:00
parent ac7653a433
commit 0d3d3be1e2

View file

@ -248,6 +248,7 @@ static int add_mount(
assert(what); assert(what);
assert(where); assert(where);
assert(opts); assert(opts);
assert(post);
assert(source); assert(source);
if (streq_ptr(fstype, "autofs")) if (streq_ptr(fstype, "autofs"))
@ -297,7 +298,7 @@ static int add_mount(
"Documentation=man:fstab(5) man:systemd-fstab-generator(8)\n", "Documentation=man:fstab(5) man:systemd-fstab-generator(8)\n",
source); source);
if (post && !noauto && !nofail && !automount) if (!noauto && !nofail && !automount)
fprintf(f, "Before=%s\n", post); fprintf(f, "Before=%s\n", post);
if (!automount && opts) { if (!automount && opts) {
@ -337,7 +338,7 @@ static int add_mount(
if (r < 0) if (r < 0)
return log_error_errno(r, "Failed to write unit file %s: %m", unit); return log_error_errno(r, "Failed to write unit file %s: %m", unit);
if (!noauto && post) { if (!noauto) {
lnk = strjoin(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL); lnk = strjoin(arg_dest, "/", post, nofail || automount ? ".wants/" : ".requires/", name, NULL);
if (!lnk) if (!lnk)
return log_oom(); return log_oom();
@ -368,10 +369,7 @@ static int add_mount(
"Documentation=man:fstab(5) man:systemd-fstab-generator(8)\n", "Documentation=man:fstab(5) man:systemd-fstab-generator(8)\n",
source); source);
if (post) fprintf(f, "Before=%s\n", post);
fprintf(f,
"Before=%s\n",
post);
if (opts) { if (opts) {
r = write_requires_after(f, opts); r = write_requires_after(f, opts);