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

Nicolas François nicolas.francois@centraliens.net
Wed, 18 May 2005 23:40:54 +0200


--EeQfGwPcQSOJBaQU
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello Tomasz,

A few days before 4.0.8, I sent the following patch.
It was too close to your release at this time, so I send it again now.

On Fri, Apr 15, 2005 at 10:43:57PM +0200, Nicolas Fran=E7ois wrote:
> Hello,
>=20
> Another simple Debian patch that can be applied safely.
> (related to Debian's bug #162303)

Kind Regards,
--=20
Nekral

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

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 = "???";

--EeQfGwPcQSOJBaQU--