25 lines
829 B
Plaintext
25 lines
829 B
Plaintext
$OpenBSD: patch-src_LYUtils_c,v 1.3 2017/04/30 12:08:32 fcambus Exp $
|
|
|
|
Use getenv("HOME") to determine the home directory instead of using getpwuid in
|
|
order to avoid a "getpw" promise. This is the only location not covered by the
|
|
'-DNOUSERS' option in the Makefile. If HOME is unset, the fallback is /tmp, so
|
|
no breakage is to be expected from this.
|
|
|
|
--- src/LYUtils.c.orig Thu Nov 24 16:35:29 2016
|
|
+++ src/LYUtils.c Sat Apr 29 11:09:38 2017
|
|
@@ -5252,10 +5252,11 @@ const char *Home_Dir(void)
|
|
/*
|
|
* One could use getlogin() and getpwnam() here instead.
|
|
*/
|
|
- struct passwd *pw = getpwuid(geteuid());
|
|
+ char *home;
|
|
|
|
- if (pw && pw->pw_dir) {
|
|
- StrAllocCopy(HomeDir, pw->pw_dir);
|
|
+ home = getenv("HOME");
|
|
+ if (home && *home) {
|
|
+ StrAllocCopy(HomeDir, home);
|
|
} else
|
|
#endif
|
|
{
|