diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-11-27 20:23:18 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-11-27 20:28:48 +0100 |
commit | 613b411c947635136637f8cdd66b94512f761eab (patch) | |
tree | 5e0713345af39de99409d2193be93ae9e760e1d2 /src/shared/util.c | |
parent | df41776d66b5b7467a5cf9c719b97b66d6534c8c (diff) |
service: add the ability for units to join other unit's PrivateNetwork= and PrivateTmp= namespaces
Diffstat (limited to 'src/shared/util.c')
-rw-r--r-- | src/shared/util.c | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/shared/util.c b/src/shared/util.c index 3a4d1965ae..d31bd52949 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -5705,56 +5705,6 @@ int search_and_fopen_nulstr(const char *path, const char *mode, const char *sear return search_and_fopen_internal(path, mode, s, _f); } -int create_tmp_dir(char template[], char** dir_name) { - int r = 0; - char *d = NULL, *dt; - - assert(dir_name); - - RUN_WITH_UMASK(0077) { - d = mkdtemp(template); - } - if (!d) { - log_error("Can't create directory %s: %m", template); - return -errno; - } - - dt = strjoin(d, "/tmp", NULL); - if (!dt) { - r = log_oom(); - goto fail3; - } - - RUN_WITH_UMASK(0000) { - r = mkdir(dt, 0777); - } - if (r < 0) { - log_error("Can't create directory %s: %m", dt); - r = -errno; - goto fail2; - } - log_debug("Created temporary directory %s", dt); - - r = chmod(dt, 0777 | S_ISVTX); - if (r < 0) { - log_error("Failed to chmod %s: %m", dt); - r = -errno; - goto fail1; - } - log_debug("Set sticky bit on %s", dt); - - *dir_name = dt; - - return 0; -fail1: - rmdir(dt); -fail2: - free(dt); -fail3: - rmdir(template); - return r; -} - char *strextend(char **x, ...) { va_list ap; size_t f, l; |