[Pkg-shadow-devel] [PATCH_02] a Debian patch for newgrp.c

Nicolas François nicolas.francois@centraliens.net
Fri, 15 Apr 2005 22:43:57 +0200


--DBIVS5p969aUjpLe
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello,

Another simple Debian patch that can be applied safely.
(related to Debian's bug #162303)

-- 
Nekral

--DBIVS5p969aUjpLe
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="newgrp.c_162303"

Index: src/newgrp.c
===================================================================
RCS file: /cvsroot/shadow/src/newgrp.c,v
retrieving revision 1.27
diff -u -r1.27 newgrp.c
--- src/newgrp.c	31 Mar 2005 05:14:54 -0000	1.27
+++ src/newgrp.c	15 Apr 2005 20:38:32 -0000
@@ -379,8 +379,13 @@
 		SYSLOG ((LOG_INFO, "user `%s' switched to group `%s'",
 			 name, group));
 	if (getdef_bool ("SYSLOG_SG_ENAB")) {
-		char *loginname = xstrdup (getlogin ());
-		char *tty = xstrdup (ttyname (0));
+		char *loginname = getlogin ();
+		char *tty = ttyname (0);
+
+		if (loginname != NULL)
+			loginname = xstrdup (loginname);
+		if (tty != NULL)
+			tty = xstrdup (tty);
 
 		if (loginname == NULL)
 			loginname = "???";

--DBIVS5p969aUjpLe--