From e216f91ebc5686040b028267baac0d9e649cc47a Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Fri, 25 Mar 2016 09:21:45 +0100 Subject: 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 Signed-off-by: Dirk Hohndel --- subsurface-core/dive.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'subsurface-core/dive.h') diff --git a/subsurface-core/dive.h b/subsurface-core/dive.h index d52ef5272..204d34819 100644 --- a/subsurface-core/dive.h +++ b/subsurface-core/dive.h @@ -495,7 +495,7 @@ extern const struct units SI_units, IMPERIAL_units; extern struct units xml_parsing_units; extern struct units *get_units(void); -extern int run_survey, verbose, quit; +extern int run_survey, verbose, quit, force_root; struct dive_table { int nr, allocated, preexisting; @@ -697,6 +697,7 @@ extern struct zip *subsurface_zip_open_readonly(const char *path, int flags, int extern int subsurface_zip_close(struct zip *zip); extern void subsurface_console_init(bool dedicated); extern void subsurface_console_exit(void); +extern bool subsurface_user_is_root(void); extern void shift_times(const timestamp_t amount); extern timestamp_t get_times(); -- cgit v1.2.3-70-g09d2