From 105760fe7d3e7226ee4e576dd354a2b970479a5d403f746d83208884ce566dc6 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Fri, 24 Jun 2016 10:08:15 +0000 Subject: [PATCH] boo#986211 OBS-URL: https://build.opensuse.org/package/show/Base:System/man?expand=0&rev=69 --- man.changes | 6 ++++++ wrapper.c | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/man.changes b/man.changes index 622fbe6..7715aad 100644 --- a/man.changes +++ b/man.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jun 24 10:06:32 UTC 2016 - werner@suse.de + +- Give man(1) command a home that is let pager less(1) handle its + history (boo#986211) + ------------------------------------------------------------------- Mon Mar 21 15:04:48 UTC 2016 - bwiedemann@suse.com diff --git a/wrapper.c b/wrapper.c index 578c945..d964424 100644 --- a/wrapper.c +++ b/wrapper.c @@ -102,6 +102,8 @@ int main (int argc, char **argv, char *envp[]) printf ("%s\n", wlp->run); #endif if (ruid == 0 || euid == 0) { + static char *dummy_environ[] = { NULL }; + extern char **environ; struct passwd *pwd; char *cwd; @@ -142,6 +144,16 @@ int main (int argc, char **argv, char *envp[]) return -EACCES; } free(cwd); + + cwd = getenv("TERM"); + environ = dummy_environ; + setenv("HOME", pwd->pw_dir, 1); + setenv("PATH", "/bin:/usr/bin", 1); + setenv("USER", pwd->pw_name, 1); + setenv("LOGNAME", pwd->pw_name, 1); + if (cwd) + setenv("TERM", cwd, 1); + envp = environ; } execve (wlp->run, argv, envp); perror ("execve");