diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-01-20 19:54:51 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-01-20 21:28:37 +0100 |
commit | 7f112f50fea585411ea2d493b3582bea77eb4d6e (patch) | |
tree | 2c670344aa6be9fff8bf4538d2e188bf280ecde3 /src/shared/dev-setup.c | |
parent | 3540c7f88fd4b860d3d6d0e931ddb7cd91bc559a (diff) | |
download | systemd-7f112f50fea585411ea2d493b3582bea77eb4d6e.tar.gz systemd-7f112f50fea585411ea2d493b3582bea77eb4d6e.tar.bz2 systemd-7f112f50fea585411ea2d493b3582bea77eb4d6e.zip |
exec: introduce PrivateDevices= switch to provide services with a private /dev
Similar to PrivateNetwork=, PrivateTmp= introduce PrivateDevices= that
sets up a private /dev with only the API pseudo-devices like /dev/null,
/dev/zero, /dev/random, but not any physical devices in them.
Diffstat (limited to 'src/shared/dev-setup.c')
-rw-r--r-- | src/shared/dev-setup.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/shared/dev-setup.c b/src/shared/dev-setup.c index 50a187fda9..e025e17bbe 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 *prefix) { +int dev_setup(const char *prefix) { const char *j, *k; static const char symlinks[] = @@ -69,16 +69,16 @@ void dev_setup(const char *prefix) { } if (prefix) { - char *linkname; + _cleanup_free_ char *link_name = NULL; - if (asprintf(&linkname, "%s/%s", prefix, k) < 0) { - log_oom(); - break; - } + link_name = strjoin(prefix, "/", k, NULL); + if (!link_name) + return -ENOMEM; - symlink_and_label(j, linkname); - free(linkname); + symlink_and_label(j, link_name); } else symlink_and_label(j, k); } + + return 0; } |