Checks to see if unsigned integers < 0
idra at samba.org
Mon Jul 15 06:47:12 MDT 2013
On Mon, 2013-07-15 at 11:28 +0200, Volker Lendecke wrote:
> On Fri, Jul 12, 2013 at 08:36:13PM +0200, Herwin Weststrate wrote:
> > (Issues were found compiling with clang, so it's a kind of static
> > code analysis)
> > A number of times some checks are run to see if an unsigned integer
> > is smaller than zero. Of course this cannot be true, this patch
> > removes these checks.
> Question -- is it guaranteed by Posix that uid_t is unsigned?
All I can find about uids in Posix:
3.430 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.
It says the id must be a non-negative integer. Granted it could be
represented by a signed integer with the prohibition to use its negative
values, but that is highly unlikely. It is more likely that all
platforms simply typedef a unsigned int to uid_t
More information about the samba-technical