diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-08-21 17:23:03 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-08-21 17:23:03 +0200 |
commit | 01ed0e2307f3b889b64165fd503d79b4568c47e1 (patch) | |
tree | 097d1db9e1368af620607f779864fad75fbdd04d /src/shared/dev-setup.c | |
parent | nspawn: add /dev FD symlinks in container setup (diff) | |
download | systemd-01ed0e2307f3b889b64165fd503d79b4568c47e1.tar.xz systemd-01ed0e2307f3b889b64165fd503d79b4568c47e1.zip |
dev-setup: make NULL as parameter for dev_setup() equivalent to ""
Diffstat (limited to 'src/shared/dev-setup.c')
-rw-r--r-- | src/shared/dev-setup.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/shared/dev-setup.c b/src/shared/dev-setup.c index 759ecd799f..b0ac02d461 100644 --- a/src/shared/dev-setup.c +++ b/src/shared/dev-setup.c @@ -50,7 +50,7 @@ static int symlink_and_label(const char *old_path, const char *new_path) { return r; } -void dev_setup(const char *pathprefix) { +void dev_setup(const char *prefix) { const char *j, *k; static const char symlinks[] = @@ -61,15 +61,18 @@ void dev_setup(const char *pathprefix) { "/proc/self/fd/2\0" "/dev/stderr\0"; NULSTR_FOREACH_PAIR(j, k, symlinks) { - char *linkname; - if (asprintf(&linkname, "%s/%s", pathprefix, k) < 0) { - log_oom(); - break; - } + if (prefix) { + char *linkname; - symlink_and_label(j, linkname); + if (asprintf(&linkname, "%s/%s", prefix, k) < 0) { + log_oom(); + break; + } - free(linkname); + symlink_and_label(j, linkname); + free(linkname); + } else + symlink_and_label(j, k); } } |