openbsd-ports/www/lynx/patches/patch-src_LYUtils_c
fcambus 40dfb8de1a Update lynx to 2.8.9pl13.
While there, amend our lynx.cfg patch to switch default site to HTTPS.
2017-04-30 12:08:32 +00:00

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
{