Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Sep 2019 18:51:59 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352262 - head/contrib/mtree
Message-ID:  <201909121851.x8CIpxrp015606@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Thu Sep 12 18:51:59 2019
New Revision: 352262
URL: https://svnweb.freebsd.org/changeset/base/352262

Log:
  mtree -c: Fix username logic when getlogin(3) fails.
  
  Obtained from:	NetBSD (Credit to Sascha Wildner with DragonFlyBSD)
  MFC after:	2 weeks

Modified:
  head/contrib/mtree/create.c

Modified: head/contrib/mtree/create.c
==============================================================================
--- head/contrib/mtree/create.c	Thu Sep 12 18:44:48 2019	(r352261)
+++ head/contrib/mtree/create.c	Thu Sep 12 18:51:59 2019	(r352262)
@@ -117,7 +117,7 @@ cwalk(FILE *fp)
 	host[sizeof(host) - 1] = '\0';
 	if ((user = getlogin()) == NULL) {
 		struct passwd *pw;
-		user = (pw = getpwuid(getuid())) == NULL ? pw->pw_name :
+		user = (pw = getpwuid(getuid())) != NULL ? pw->pw_name :
 		    "<unknown>";
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909121851.x8CIpxrp015606>