chiark / gitweb /
util: fix comment
[elogind.git] / src / shared / util.c
index e7ff0f8840fdbe5d85c82e0c55d0367a4833c2b7..af6bde2c3dd280e8c3f72f090d035d8d88b32e17 100644 (file)
@@ -280,6 +280,14 @@ int parse_uid(const char *s, uid_t* ret_uid) {
         if ((unsigned long) uid != ul)
                 return -ERANGE;
 
+        /* Some libc APIs use (uid_t) -1 as special placeholder */
+        if (uid == (uid_t) 0xFFFFFFFF)
+                return -EINVAL;
+
+        /* A long time ago UIDs where 16bit, hence explicitly avoid the 16bit -1 too */
+        if (uid == (uid_t) 0xFFFF)
+                return -EINVAL;
+
         *ret_uid = uid;
         return 0;
 }