diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/dev-setup.c | 16 | ||||
-rw-r--r-- | src/shared/dev-setup.h | 7 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src/shared/dev-setup.c b/src/shared/dev-setup.c index 0b3d648acb..759ecd799f 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(void) { +void dev_setup(const char *pathprefix) { const char *j, *k; static const char symlinks[] = @@ -60,6 +60,16 @@ void dev_setup(void) { "/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); + } } diff --git a/src/shared/dev-setup.h b/src/shared/dev-setup.h index 58507587d4..320c0b30ba 100644 --- a/src/shared/dev-setup.h +++ b/src/shared/dev-setup.h @@ -1,7 +1,6 @@ /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ -#ifndef foodevsetuphfoo -#define foodevsetuphfoo +#pragma once /*** This file is part of systemd. @@ -22,6 +21,4 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ -void dev_setup(void); - -#endif +void dev_setup(const char *pathprefix); |