summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/util.c50
-rw-r--r--src/shared/util.h1
2 files changed, 0 insertions, 51 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;
diff --git a/src/shared/util.h b/src/shared/util.h
index e46438c92d..1662bd4457 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -636,7 +636,6 @@ int on_ac_power(void);
int search_and_fopen(const char *path, const char *mode, const char **search, FILE **_f);
int search_and_fopen_nulstr(const char *path, const char *mode, const char *search, FILE **_f);
-int create_tmp_dir(char template[], char** dir_name);
#define FOREACH_LINE(line, f, on_error) \
for (;;) \