diff options
author | 2019-08-18 10:47:53 -0500 | |
---|---|---|
committer | 2019-08-18 10:47:53 -0500 | |
commit | d306c63570782aab9406e5f2574da0dd1c9bafa8 (patch) | |
tree | a8564a054539069bdf726d79d2ae9810b89ef07e /src/firecfg | |
parent | Merge pull request #2915 from corecontingency/master (diff) | |
parent | get_user() do not use the unreliable getlogin() (diff) | |
download | firejail-d306c63570782aab9406e5f2574da0dd1c9bafa8.tar.gz firejail-d306c63570782aab9406e5f2574da0dd1c9bafa8.tar.zst firejail-d306c63570782aab9406e5f2574da0dd1c9bafa8.zip |
Merge pull request #2909 from gm10/fix-get_user
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); |