util: drop UID_IS_INVALID() in favour of uid_is_valid()

No need to keep both functions, settle on uid_is_valid() for everything.
This commit is contained in:
Lennart Poettering
2015-09-22 16:31:32 +02:00
parent f6c2284ad3
commit c077529ba6
5 changed files with 15 additions and 24 deletions
-12
View File
@@ -470,18 +470,6 @@ do { \
#define GID_INVALID ((gid_t) -1)
#define MODE_INVALID ((mode_t) -1)
static inline bool UID_IS_INVALID(uid_t uid) {
/* We consider both the old 16bit -1 user and the newer 32bit
* -1 user invalid, since they are or used to be incompatible
* with syscalls such as setresuid() or chown(). */
return uid == (uid_t) ((uint32_t) -1) || uid == (uid_t) ((uint16_t) -1);
}
static inline bool GID_IS_INVALID(gid_t gid) {
return gid == (gid_t) ((uint32_t) -1) || gid == (gid_t) ((uint16_t) -1);
}
#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
static inline void func##p(type *p) { \
if (*p) \
+4 -1
View File
@@ -161,7 +161,10 @@ int parse_uid(const char *s, uid_t* ret_uid);
#define parse_gid(s, ret_gid) parse_uid(s, ret_gid)
bool uid_is_valid(uid_t uid);
#define gid_is_valid(gid) uid_is_valid(gid)
static inline bool gid_is_valid(gid_t gid) {
return uid_is_valid((uid_t) gid);
}
int safe_atou(const char *s, unsigned *ret_u);
int safe_atoi(const char *s, int *ret_i);