mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
d99c931219
commit
e216f91ebc
7 changed files with 28 additions and 2 deletions
|
@ -59,6 +59,11 @@ int main(int argc, char **argv)
|
|||
files.push_back(a);
|
||||
}
|
||||
}
|
||||
if (subsurface_user_is_root() && !force_root) {
|
||||
printf("You are running Subsurface as root. This is not recommended.\n");
|
||||
printf("If you insist to do so, run with option --allow_run_as_root.\n");
|
||||
exit(0);
|
||||
}
|
||||
#if !LIBGIT2_VER_MAJOR && LIBGIT2_VER_MINOR < 22
|
||||
git_threads_init();
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue