Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Nov 2011 16:40:17 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r227223 - head/usr.sbin/chroot
Message-ID:  <201111061640.pA6GeHvF030581@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Sun Nov  6 16:40:17 2011
New Revision: 227223
URL: http://svn.freebsd.org/changeset/base/227223

Log:
  Eliminate global variables.
  
  There is no reason why these three variables should be declared as
  global variables, while the others aren't. They are only used inside
  main().

Modified:
  head/usr.sbin/chroot/chroot.c

Modified: head/usr.sbin/chroot/chroot.c
==============================================================================
--- head/usr.sbin/chroot/chroot.c	Sun Nov  6 16:37:50 2011	(r227222)
+++ head/usr.sbin/chroot/chroot.c	Sun Nov  6 16:40:17 2011	(r227223)
@@ -56,16 +56,12 @@ __FBSDID("$FreeBSD$");
 
 static void usage(void);
 
-char	*user;		/* user to switch to before running program */
-char	*group;		/* group to switch to ... */
-char	*grouplist;	/* group list to switch to ... */
-
 int
 main(int argc, char *argv[])
 {
 	struct group	*gp;
 	struct passwd	*pw;
-	char		*endp, *p;
+	char		*endp, *p, *user, *group, *grouplist;
 	const char	*shell;
 	gid_t		gid, *gidlist;
 	uid_t		uid;
@@ -74,6 +70,7 @@ main(int argc, char *argv[])
 
 	gid = 0;
 	uid = 0;
+	user = group = grouplist = NULL;
 	while ((ch = getopt(argc, argv, "G:g:u:")) != -1) {
 		switch(ch) {
 		case 'u':



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