On 25 March 2016 at 12:31, Lubomir I. Ivanov <[email protected]> wrote:
> hello,
>
> On 25 March 2016 at 10:27, Robert C. Helling <[email protected]> wrote:
>> + if ((getegid() == 0) && !verbose) {
>> + printf("You are running Subsurface as root. This is not
>> recommended.\n");
>> + printf("If you insist to do so, run with option -v.\n");
>> + exit(0);
>> + }
>
> there is no WINAPI (Windows) wrapper for the POSIX function getegid(),
> as the SIDs on Windows work slightly differently that the Unix GIDs.
>
> i'd suggest the following function in all the platform specific files
> (linux.c, windows.c...):
> subsurface_user_is_root()
>
> where getegid() == 0 is used on Unix OSes and possibly IsUserAnAdmin()
> on Windows.
> i can send a patch later for that.
>
hmm...on the other hand many users on Windows (me including) simply
run as an "Administrator" (root) all the time, so i don't think we
want to throw the error on Windows, as is.
for now, i can suggest a:
#ifndef Q_OS_WIN
if ((getegid() == 0) && !verbose) {
...
#endif
lubomir
--
_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface