Prevent unintentionally running as root

Some users try to run Subsurface as root for example to get around
permission problems with dive computer devices. This is a bad idea
since config files get touched as root and then cannot be read
as normal user anymore.

This patch allows running as root only with verbose option on. We can
assume if somebody manages to start subsurface as root this happens
from the command line.

For some reason, I couldn't get translation working at this stage.

Windows version is a stub.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2016-03-25 09:21:45 +01:00 committed by Dirk Hohndel
parent d99c931219
commit e216f91ebc
7 changed files with 28 additions and 2 deletions

View file

@ -225,3 +225,8 @@ void subsurface_console_exit(void)
{
/* NOP */
}
bool subsurface_user_is_root()
{
return (geteuid() == 0);
}