From 6bed0dfc5f74858634ca6c76b676cee8bc9ffd92 Mon Sep 17 00:00:00 2001 From: Lubos Dolezel Date: Sat, 25 Apr 2020 17:11:51 +0200 Subject: [PATCH] Fix #715 --- src/startup/darling.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/startup/darling.c b/src/startup/darling.c index 95b2126f7..101ba2580 100644 --- a/src/startup/darling.c +++ b/src/startup/darling.c @@ -44,6 +44,7 @@ along with Darling. If not, see . #include #include #include +#include #include "../shellspawn/shellspawn.h" #include "darling.h" #include "darling-config.h" @@ -1318,7 +1319,16 @@ void setupUserHome(void) mkdir(buf, 0777); const char* home = getenv("HOME"); - const char* login = getlogin(); + + const char* login = NULL; + struct passwd* pw = getpwuid(getuid()); + + if (pw != NULL) + login = pw->pw_name; + + if (!login) + login = getlogin(); + if (!login) { fprintf(stderr, "Cannot determine your user name\n"); -- 2.51.2