So just return it?
bool isRoot(void) {return getuid()==0;}
1) You didn't include <stdbool.h>
2) Your isRoot function doesn't look like the one I posted.
is this?
#include <stdio.h>
#include <stdbool.h>
bool isRoot(){
if (getuid() != 0){
return getuid()==0;
} else {
return getuid()==1;
}
}
int main(){
if (isRoot() == 0){
printf("root\n");
} else {
printf("other\n");
}
return 0;
}
??
is wrong :-(
andre@Andre:~$ gcc lib.c -o lib
andre@Andre:~$ ./lib
root
Thank you, man. And sorry for my bad english, i'm from brazil.