[Toybox] [PATCH] Remove unused variable in toys/id.c

Georgi Chorbadzhiyski gf at unixsol.org
Mon Feb 27 16:26:55 PST 2012


The attached patch fixes compiler warning by removing an unused but set variable.

   toys/id.c: In function 'id_main':
   toys/id.c:63:8: warning: variable 'gid' set but not used [-Wunused-but-set-variable]

-- 
Georgi Chorbadzhiyski
http://georgi.unixsol.org/
-------------- next part --------------
The following patch fixes compiler warning by removing an unused but set variable.

  toys/id.c: In function 'id_main':
  toys/id.c:63:8: warning: variable 'gid' set but not used [-Wunused-but-set-variable]

diff -r 763d581badae toys/id.c
--- a/toys/id.c	Sun Feb 26 22:04:37 2012 -0600
+++ b/toys/id.c	Tue Feb 28 02:03:40 2012 +0200
@@ -60,7 +60,6 @@
 	struct group *grp;
 	struct group **grps;
 	uid_t uid;
-	gid_t gid;
 	gid_t *groups;
 	int i;
 	int ngroups;
@@ -76,15 +75,12 @@
 			return;
 		}
 		uid = pw->pw_uid;
-		gid = pw->pw_gid;
 	} else {
 		/* show effective, unless user specifies real */
 		if (flags & FLAG_r) {
 			uid = getuid();
-			gid = getgid();
 		} else {
 			uid = geteuid();
-			gid = getegid();
 		}
 	}
 


More information about the Toybox mailing list