summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/mount-setup.c2
-rw-r--r--src/shared/dev-setup.c19
-rw-r--r--src/udev/udevd.c2
3 files changed, 13 insertions, 10 deletions
diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
index be11bb8f36..1a82a46fef 100644
--- a/src/core/mount-setup.c
+++ b/src/core/mount-setup.c
@@ -398,7 +398,7 @@ int mount_setup(bool loaded_policy) {
/* Create a few default symlinks, which are normally created
* by udevd, but some scripts might need them before we start
* udevd. */
- dev_setup("");
+ dev_setup(NULL);
/* Mark the root directory as shared in regards to mount
* propagation. The kernel defaults to "private", but we think
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);
}
}
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 1bb15d8c9e..b4fc624db3 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1155,7 +1155,7 @@ int main(int argc, char *argv[])
mkdir("/run/udev", 0755);
- dev_setup("");
+ dev_setup(NULL);
static_dev_create_from_modules(udev);
/* before opening new files, make sure std{in,out,err} fds are in a sane state */