Ludovic =?UTF-8?Q?Court=C3=A8s?= writes:
>
> OTOH, on POSIX-conforming systems (which includes GNU/Linux, so it may
> be the majority of systems in use), -1 may well be a valid UID/GID.
That's a bizarre statement.
3.428 User ID
A non-negative integer that is used to identify a system user. When the
identity of a user is associated with a process, a user ID value is
referred to as a real user ID, an effective user ID, or a saved
set-user-ID.
chown(2) uses (uid_t)-1 and (gid_t)-1 as the "don't change" special values.
So does setreuid(2)/setregid(2).
setuid(-1) isn't documented as special. Trying it out, it seems to be treated
as equivalent to setuid(1). Not what I expected, but it doesn't really
support your "-1 is a valid uid" theory.
--
Alan Curry