Re: Apache FCGI Module 1.3 Problem
djulien@apc.net
Mon, 09 Sep 96 18:17:57 GMT
From: djulien@apc.net
To: langles@VOTE-SMART.ORG (Scott Langley)
Subject: Re: Apache FCGI Module 1.3 Problem
Date: Mon, 09 Sep 96 18:17:57 GMT
Message-Id: <M.090996.111757.49@djulien.apc.net>
-----------------------------------------------------------------------
> mod_fastcgi.c: In function `FastCgiIpcDirCmd':
> mod_fastcgi.c:1802: warning: comparison is always 0 due to limited range
> of data type
> mod_fastcgi.c:1803: warning: comparison is always 0 due to limited range
> of data type
> mod_fastcgi.c: In function `AppClassCmd':
> mod_fastcgi.c:2188: warning: comparison is always 0 due to limited range
> of data type
> mod_fastcgi.c:2189: warning: comparison is always 0 due to limited range
> of data type
> -----------------------------------------------------------------------
>
> That is, these comparisons in mod_fastcgi.c:
>
> uid = (user_id == -1) ? geteuid() : user_id;
> gid = (group_id == -1) ? getegid() : group_id;
>
> operate on user_id and group_id which are type unsigned short, due to the
> following definition in: linux/include/asm/posix_types.h
>
> typedef unsigned short __kernel_uid_t;
I haven't worked with Apache, but here's my opinion from having worked with C,
for what it's worth ...
The compiler is telling you that (unsigned)anything will never == -1. To fix
this, just type cast -1 to be the type as the other operand:
> uid = (user_id == (__kernel_uid_t)-1) ? geteuid() : user_id;
> gid = (group_id == (__kernel_uid_t)-1) ? getegid() : group_id;
(assuming user_id and group_id were declared as type __kernel_uid_t). This
will tell the compiler to convert -1 to the appropriate type before doing the
compare, which should then do what was intended.
Hope this helps.
Don Julien
djulien@apc.net