summaryrefslogtreecommitdiffstats
path: root/src/shared/dev-setup.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-08-21 17:23:03 +0200
committerLennart Poettering <lennart@poettering.net>2012-08-21 17:23:03 +0200
commit01ed0e2307f3b889b64165fd503d79b4568c47e1 (patch)
tree097d1db9e1368af620607f779864fad75fbdd04d /src/shared/dev-setup.c
parentnspawn: add /dev FD symlinks in container setup (diff)
downloadsystemd-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.c19
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);
}
}