diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-12-02 12:59:21 +0100 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-12-02 12:59:21 +0100 |
commit | 9fe3995e8e2f9f4159c693663b9cc08dc37ff3f1 (patch) | |
tree | 9e85acc32c96a708aa6b140c794ef678b0cc1ffc /src/basic/user-util.h | |
parent | a0d39da6b5b076931b9683a37d94b58a8011f966 (diff) |
user-util: add new uid_is_system() helper
This adds uid_is_system() and gid_is_system(), similar in style to
uid_is_dynamic(). That a helper like this is useful is illustrated by
the fact that test-condition.c didn't get the check right so far, which
this patch fixes.
Diffstat (limited to 'src/basic/user-util.h')
-rw-r--r-- | src/basic/user-util.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/basic/user-util.h b/src/basic/user-util.h index f60166f79..b619239b8 100644 --- a/src/basic/user-util.h +++ b/src/basic/user-util.h @@ -71,6 +71,14 @@ static inline bool uid_is_dynamic(uid_t uid) { return DYNAMIC_UID_MIN <= uid && uid <= DYNAMIC_UID_MAX; } +static inline bool uid_is_system(uid_t uid) { + return uid <= SYSTEM_UID_MAX; +} + +static inline bool gid_is_system(gid_t gid) { + return gid <= SYSTEM_GID_MAX; +} + /* The following macros add 1 when converting things, since UID 0 is a valid UID, while the pointer * NULL is special */ #define PTR_TO_UID(p) ((uid_t) (((uintptr_t) (p))-1)) |