summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-03-03 17:14:07 +0100
committerLennart Poettering <lennart@poettering.net>2014-03-03 17:55:32 +0100
commite66cf1a3f94fff48a572f6dbd19b43c9bcf7b8c7 (patch)
treee3580f7a1e9aaca01ada8575a1ea50a7a32dd2d3 /src/shared
parentb64a3d86bcc3b3698824019d0ebdc2117ad31bb5 (diff)
core: introduce new RuntimeDirectory= and RuntimeDirectoryMode= unit settings
As discussed on the ML these are useful to manage runtime directories below /run for services.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/exit-status.c3
-rw-r--r--src/shared/exit-status.h1
-rw-r--r--src/shared/mkdir.c4
3 files changed, 6 insertions, 2 deletions
diff --git a/src/shared/exit-status.c b/src/shared/exit-status.c
index c1b04a3868..c1c0861168 100644
--- a/src/shared/exit-status.c
+++ b/src/shared/exit-status.c
@@ -142,6 +142,9 @@ const char* exit_status_to_string(ExitStatus status, ExitStatusLevel level) {
case EXIT_ADDRESS_FAMILIES:
return "ADDRESS_FAMILIES";
+
+ case EXIT_RUNTIME_DIRECTORY:
+ return "RUNTIME_DIRECTORY";
}
}
diff --git a/src/shared/exit-status.h b/src/shared/exit-status.h
index e7f12032ec..9dc3fce0bf 100644
--- a/src/shared/exit-status.h
+++ b/src/shared/exit-status.h
@@ -72,6 +72,7 @@ typedef enum ExitStatus {
EXIT_PERSONALITY, /* 230 */
EXIT_APPARMOR_PROFILE,
EXIT_ADDRESS_FAMILIES,
+ EXIT_RUNTIME_DIRECTORY
} ExitStatus;
typedef enum ExitStatusLevel {
diff --git a/src/shared/mkdir.c b/src/shared/mkdir.c
index 43c6ea6d4a..4a2cd5e662 100644
--- a/src/shared/mkdir.c
+++ b/src/shared/mkdir.c
@@ -42,8 +42,8 @@ int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, mkd
return -errno;
if ((st.st_mode & 0777) != mode ||
- st.st_uid != uid ||
- st.st_gid != gid ||
+ (uid != (uid_t) -1 && st.st_uid != uid) ||
+ (gid != (gid_t) -1 && st.st_gid != gid) ||
!S_ISDIR(st.st_mode)) {
errno = EEXIST;
return -errno;