[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/02: profiles: Use 'getpwuid' when $USER and $LOGNAME are undefined.
From: |
guix-commits |
Subject: |
02/02: profiles: Use 'getpwuid' when $USER and $LOGNAME are undefined. |
Date: |
Tue, 10 Dec 2019 14:56:25 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit c20ba18304ee63f01895f092bb51bc2a9ce3303b
Author: Ludovic Courtès <address@hidden>
Date: Tue Dec 10 17:21:31 2019 +0100
profiles: Use 'getpwuid' when $USER and $LOGNAME are undefined.
Reported by YOANN P <address@hidden>.
* guix/profiles.scm (%profile-directory): Fall back to 'getpwuid' when
"USER" and "LOGNAME" are undefined.
---
guix/profiles.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/guix/profiles.scm b/guix/profiles.scm
index f5e5cc3..6166051 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1727,7 +1727,9 @@ because the NUMBER is zero.)"
(define %profile-directory
(string-append %state-directory "/profiles/"
(or (and=> (or (getenv "USER")
- (getenv "LOGNAME"))
+ (getenv "LOGNAME")
+ (false-if-exception
+ (passwd:name (getpwuid (getuid)))))
(cut string-append "per-user/" <>))
"default")))