...
Code Block | ||
---|---|---|
| ||
/* First the options that are only allowed for root */ if (getuid() == 0 || geteuid != 0) { /* ... */ } |
Implementation-Specific Details
This error can often be detected through the analysis of compiler warnings. For example, when this code is compiled with some versions of the GCC compiler,
Code Block |
---|
#include <unistd.h>
#include <stdlib.h>
int main(void) {
geteuid ? exit(0) : exit(1);
}
|
the following warning will be generated:
Code Block |
---|
example.c: In function 'main':
example.c:6: warning: the address of 'geteuid', will always
evaluate as 'true'
|
Compliant Solution
The solution is to provide the open and close parentheses following the geteuid
token so that the function is properly invoked.
...