core: add EXEC_DIRECTORY_TYPE_SHALL_CHOWN() helper

Let's make ConfigurationDirectory= a bit less "special-casey", by hiding
the fact that it's the only per-service dir we do not do chown()ing for
inside of a new EXEC_DIRECTORY_TYPE_SHALL_CHOWN() helper.
This commit is contained in:
Lennart Poettering
2024-10-30 13:33:29 +01:00
parent ba21b29039
commit 2ef87de9d3
3 changed files with 12 additions and 5 deletions
+6
View File
@@ -152,6 +152,12 @@ typedef enum ExecDirectoryType {
_EXEC_DIRECTORY_TYPE_INVALID = -EINVAL,
} ExecDirectoryType;
static inline bool EXEC_DIRECTORY_TYPE_SHALL_CHOWN(ExecDirectoryType t) {
/* Returns true for the ExecDirectoryTypes that we shall chown()ing for the user to. We do this for
* all of them, except for configuration */
return t >= 0 && t < _EXEC_DIRECTORY_TYPE_MAX && t != EXEC_DIRECTORY_CONFIGURATION;
}
typedef struct ExecDirectoryItem {
char *path;
char **symlinks;