diff options
author | 2019-08-13 14:39:33 +0200 | |
---|---|---|
committer | 2019-08-13 14:46:54 +0200 | |
commit | 3fdc5b15654d894f8575c3c86e354db0d081fbf5 (patch) | |
tree | b71ff3832f60df7b69f2552c36df9942dda8d38f /src/firecfg | |
parent | virtualbox: sort capabilities (diff) | |
download | firejail-3fdc5b15654d894f8575c3c86e354db0d081fbf5.tar.gz firejail-3fdc5b15654d894f8575c3c86e354db0d081fbf5.tar.zst firejail-3fdc5b15654d894f8575c3c86e354db0d081fbf5.zip |
get_user() do not use the unreliable getlogin()
Diffstat (limited to 'src/firecfg')
-rw-r--r-- | src/firecfg/main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/firecfg/main.c b/src/firecfg/main.c index ff66dea08..3f5921322 100644 --- a/src/firecfg/main.c +++ b/src/firecfg/main.c | |||
@@ -284,9 +284,9 @@ static void set_links_homedir(const char *homedir) { | |||
284 | } | 284 | } |
285 | 285 | ||
286 | static char *get_user(void) { | 286 | static char *get_user(void) { |
287 | char *user = getlogin(); | 287 | char *user = getenv("SUDO_USER"); |
288 | if (!user) { | 288 | if (!user) { |
289 | user = getenv("SUDO_USER"); | 289 | user = getpwuid(getuid())->pw_name; |
290 | if (!user) { | 290 | if (!user) { |
291 | fprintf(stderr, "Error: cannot detect login user\n"); | 291 | fprintf(stderr, "Error: cannot detect login user\n"); |
292 | exit(1); | 292 | exit(1); |