[Pkg-shadow-devel] [PATCH] su: also preserve COLORTERM

Mike Frysinger vapier at gentoo.org
Thu Dec 25 21:46:40 UTC 2008


From: Sebastian Rick Rijkers <srrijkers at gmail.com>

For some terminals COLORTERM seems to be the only way for checking for that
specific terminal. For instance, gnome-terminal sets its TERM as "xterm" but
its COLORTERM as "gnome-terminal". The COLORTERM variable is also of use when
running GNU screen since it sets TERM to "screen" but doesn't touch COLORTERM.

Currently su -l only preserves the TERM variable, COLORTERM is unset. This
simple patch makes su -l preserve the COLORTERM environment variable as well.

Signed-off-by: Sebastian Rick Rijkers <srrijkers at gmail.com>
Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 src/su.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/su.c b/src/su.c
index 0a4aac3..cc8eac1 100644
--- a/src/su.c
+++ b/src/su.c
@@ -561,6 +561,10 @@ int main (int argc, char **argv)
 		if (NULL != cp) {
 			addenv ("TERM", cp);
 		}
+		cp = getenv ("COLORTERM");
+		if (NULL != cp) {
+			addenv ("COLORTERM", cp);
+		}
 #ifndef USE_PAM
 		cp = getdef_str ("ENV_TZ");
 		if (NULL != cp) {
-- 
1.6.0.6




More information about the Pkg-shadow-devel mailing list