/* 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("");
/* Mark the root directory as shared in regards to mount
* propagation. The kernel defaults to "private", but we think
return r;
}
-void dev_setup(void) {
+void dev_setup(const char *pathprefix) {
const char *j, *k;
static const char symlinks[] =
"/proc/self/fd/1\0" "/dev/stdout\0"
"/proc/self/fd/2\0" "/dev/stderr\0";
- NULSTR_FOREACH_PAIR(j, k, symlinks)
- symlink_and_label(j, k);
+ NULSTR_FOREACH_PAIR(j, k, symlinks) {
+ char *linkname;
+
+ if (asprintf(&linkname, "%s/%s", pathprefix, k) < 0) {
+ log_oom();
+ break;
+ }
+
+ symlink_and_label(j, linkname);
+
+ free(linkname);
+ }
}
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-#ifndef foodevsetuphfoo
-#define foodevsetuphfoo
+#pragma once
/***
This file is part of systemd.
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-void dev_setup(void);
-
-#endif
+void dev_setup(const char *pathprefix);
mkdir("/run/udev", 0755);
- dev_setup();
+ dev_setup("");
static_dev_create_from_modules(udev);
/* before opening new files, make sure std{in,out,err} fds are in a sane state */