summaryrefslogtreecommitdiffstats
path: root/usr.sbin/chroot
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2011-11-06 16:40:17 +0000
committered <ed@FreeBSD.org>2011-11-06 16:40:17 +0000
commitf926e2345dc6c34c99b612cb5ed728f2d0d0c944 (patch)
tree64753ac6a2d25e5e411269d4f9ce2b18a076eb4e /usr.sbin/chroot
parent44d67fb8063193464510caa480c05b874779c43c (diff)
downloadFreeBSD-src-f926e2345dc6c34c99b612cb5ed728f2d0d0c944.zip
FreeBSD-src-f926e2345dc6c34c99b612cb5ed728f2d0d0c944.tar.gz
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().
Diffstat (limited to 'usr.sbin/chroot')
-rw-r--r--usr.sbin/chroot/chroot.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/usr.sbin/chroot/chroot.c b/usr.sbin/chroot/chroot.c
index a0122f7..9db0192 100644
--- a/usr.sbin/chroot/chroot.c
+++ b/usr.sbin/chroot/chroot.c
@@ -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':
OpenPOWER on IntegriCloud