I would like to know if user is root, without minding if that user is using a fakeroot-like tool or not.
I tried the functions getuid(), geteuid() and getlogin(), but when I launch fakeroot command each of these sends my own account information instead of root.
For this code:
printf("%d %d %s\n", getuid(), geteuid(), getlogin());
Here is what I get:
% fakeroot ./busybox rm
1000 1000 julien
When I would like to get something like:
0 0 root
(the login would be enough)