summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Cantrill <bryan@joyent.com>2013-01-04 05:43:06 +0000
committerBryan Cantrill <bryan@joyent.com>2013-01-04 05:43:06 +0000
commite5cceaaaf353c60b9b65fecb6102b607e3972847 (patch)
treefe07cd5e685da802b1eefa8237ae5029cd0d35a1
parent84bbf930fc8d4aefd2ab9c2596d1bf2109102c4b (diff)
downloadillumos-joyent-e5cceaaaf353c60b9b65fecb6102b607e3972847.tar.gz
OS-1786 /usr/bin/man should not override PATH if TROFF is set
-rw-r--r--usr/src/cmd/man/src/man.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr/src/cmd/man/src/man.c b/usr/src/cmd/man/src/man.c
index f272ecab6e..a2ef30da5b 100644
--- a/usr/src/cmd/man/src/man.c
+++ b/usr/src/cmd/man/src/man.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, Josef 'Jeff' Sipek <jeffpc@31bits.net>. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T. */
@@ -530,10 +531,14 @@ doargs:
freev(pathv);
/*
- * Since we can't make use of GNU troff, set the path to ensure we
- * find the one in /usr/bin first.
+ * If the TROFF environment variable hasn't been set, set PATH to
+ * ensure that we find nroff in /usr/bin, regardless of the user's
+ * PATH. (If the TROFF environment variable has been set, we
+ * assume that the environment has been constructed to execute the
+ * the nroff/troff found in the PATH with any options that may be
+ * specific to that implementation -- e.g., groff.)
*/
- if (putenv("PATH=/usr/bin") != 0) {
+ if (getenv("TROFF") == NULL && putenv("PATH=/usr/bin") != 0) {
perror("putenv");
exit(1);
}