summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-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);
}
}