[Pkg-shadow-commits] r2109 - in upstream/trunk: . src
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Tue Jun 10 19:45:07 UTC 2008
Author: nekral-guest
Date: 2008-06-10 19:45:06 +0000 (Tue, 10 Jun 2008)
New Revision: 2109
Modified:
upstream/trunk/ChangeLog
upstream/trunk/src/id.c
Log:
* src/id.c: Ignore the return value of fputs(), puts(), putchar(),
and printf().
* src/id.c: Ignore return value of setlocale(),
bindtextdomain(), and textdomain().
* src/id.c: Add brackets and parenthesis.
* src/id.c: Avoid implicit conversion of pointers / integers
to booleans.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2008-06-10 19:42:22 UTC (rev 2108)
+++ upstream/trunk/ChangeLog 2008-06-10 19:45:06 UTC (rev 2109)
@@ -1,5 +1,15 @@
2008-06-10 Nicolas François <nicolas.francois at centraliens.net>
+ * src/id.c: Ignore the return value of fputs(), puts(), putchar(),
+ and printf().
+ * src/id.c: Ignore return value of setlocale(),
+ bindtextdomain(), and textdomain().
+ * src/id.c: Add brackets and parenthesis.
+ * src/id.c: Avoid implicit conversion of pointers / integers
+ to booleans.
+
+2008-06-10 Nicolas François <nicolas.francois at centraliens.net>
+
* src/chsh.c: Use a bool when possible instead of int integers.
* src/chsh.c: restricted_shell() renamed is_restricted_shell().
check_shell() renamed shell_is_listed().
Modified: upstream/trunk/src/id.c
===================================================================
--- upstream/trunk/src/id.c 2008-06-10 19:42:22 UTC (rev 2108)
+++ upstream/trunk/src/id.c 2008-06-10 19:45:06 UTC (rev 2109)
@@ -53,9 +53,9 @@
static void usage (void)
{
#ifdef HAVE_GETGROUPS
- fputs (_("Usage: id [-a]\n"), stderr);
+ (void) fputs (_("Usage: id [-a]\n"), stderr);
#else
- fputs (_("Usage: id\n"), stderr);
+ (void) fputs (_("Usage: id\n"), stderr);
#endif
exit (1);
}
@@ -77,14 +77,14 @@
#ifdef HAVE_GETGROUPS
GETGROUPS_T *groups;
int ngroups;
- int aflg = 0;
+ bool aflg = 0;
#endif
struct passwd *pw;
struct group *gr;
- setlocale (LC_ALL, "");
- bindtextdomain (PACKAGE, LOCALEDIR);
- textdomain (PACKAGE);
+ (void) setlocale (LC_ALL, "");
+ (void) bindtextdomain (PACKAGE, LOCALEDIR);
+ (void) textdomain (PACKAGE);
/*
* Dynamically get the maximum number of groups from system, instead
@@ -101,14 +101,16 @@
*/
if (argc > 1) {
- if (argc > 2 || strcmp (argv[1], "-a"))
+ if ((argc > 2) || (strcmp (argv[1], "-a") != 0)) {
usage ();
- else
- aflg = 1;
+ } else {
+ aflg = true;
+ }
}
#else
- if (argc > 1)
+ if (argc > 1) {
usage ();
+ }
#endif
ruid = getuid ();
@@ -122,16 +124,18 @@
*/
pw = getpwuid (ruid); /* local, no need for xgetpwuid */
- if (pw)
- printf ("UID=%u(%s)", ruid, pw->pw_name);
- else
- printf ("UID=%u", ruid);
+ if (NULL != pw) {
+ (void) printf ("UID=%u(%s)", ruid, pw->pw_name);
+ } else {
+ (void) printf ("UID=%u", ruid);
+ }
gr = getgrgid (rgid);; /* local, no need for xgetgrgid */
- if (gr)
- printf (" GID=%u(%s)", rgid, gr->gr_name);
- else
- printf (" GID=%u", rgid);
+ if (NULL != gr) {
+ (void) printf (" GID=%u(%s)", rgid, gr->gr_name);
+ } else {
+ (void) printf (" GID=%u", rgid);
+ }
/*
* Print out the effective user ID and group ID if they are
@@ -140,17 +144,19 @@
if (ruid != euid) {
pw = getpwuid (euid); /* local, no need for xgetpwuid */
- if (pw)
- printf (" EUID=%u(%s)", euid, pw->pw_name);
- else
- printf (" EUID=%u", euid);
+ if (NULL != pw) {
+ (void) printf (" EUID=%u(%s)", euid, pw->pw_name);
+ } else {
+ (void) printf (" EUID=%u", euid);
+ }
}
if (rgid != egid) {
gr = getgrgid (egid); /* local, no need for xgetgrgid */
- if (gr)
- printf (" EGID=%u(%s)", egid, gr->gr_name);
- else
- printf (" EGID=%u", egid);
+ if (NULL != gr) {
+ (void) printf (" EGID=%u(%s)", egid, gr->gr_name);
+ } else {
+ (void) printf (" EGID=%u", egid);
+ }
}
#ifdef HAVE_GETGROUPS
/*
@@ -167,17 +173,19 @@
* where "###" is a numerical value and "aaa" is the
* corresponding name for each respective numerical value.
*/
- puts (_(" groups="));
+ (void) puts (_(" groups="));
for (i = 0; i < ngroups; i++) {
- if (i)
- putchar (',');
+ if (0 != i)
+ (void) putchar (',');
/* local, no need for xgetgrgid */
gr = getgrgid (groups[i]);
- if (gr)
- printf ("%u(%s)", groups[i], gr->gr_name);
- else
- printf ("%u", groups[i]);
+ if (NULL != gr) {
+ (void) printf ("%u(%s)",
+ groups[i], gr->gr_name);
+ } else {
+ (void) printf ("%u", groups[i]);
+ }
}
}
free (groups);
@@ -186,7 +194,7 @@
/*
* Finish off the line.
*/
- putchar ('\n');
+ (void) putchar ('\n');
exit (0);
/* NOT REACHED */
}
More information about the Pkg-shadow-commits
mailing list