[Pkg-shadow-commits] r1513 - in upstream/trunk: . src
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Thu Dec 27 21:56:46 UTC 2007
Author: nekral-guest
Date: 2007-12-27 21:56:45 +0000 (Thu, 27 Dec 2007)
New Revision: 1513
Modified:
upstream/trunk/ChangeLog
upstream/trunk/src/gpasswd.c
Log:
Avoid implicit conversions to booleans.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2007-12-27 21:43:29 UTC (rev 1512)
+++ upstream/trunk/ChangeLog 2007-12-27 21:56:45 UTC (rev 1513)
@@ -13,6 +13,7 @@
change_passwd(), check_flags(). Split out of main() to simplify main().
* src/gpasswd.c: Avoid implicit brackets.
* src/gpasswd.c: Avoid assignment in comparisons.
+ * src/gpasswd.c: Avoid implicit conversions to booleans.
2007-12-27 Nicolas François <nicolas.francois at centraliens.net>
Modified: upstream/trunk/src/gpasswd.c
===================================================================
--- upstream/trunk/src/gpasswd.c 2007-12-27 21:43:29 UTC (rev 1512)
+++ upstream/trunk/src/gpasswd.c 2007-12-27 21:56:45 UTC (rev 1513)
@@ -160,7 +160,7 @@
int errors = 0;
size_t len;
- for (start = users; start && *start; start = end) {
+ for (start = users; (NULL != start) && ('\0' != *start); start = end) {
end = strchr (start, ',');
if (NULL != end) {
len = end - start;
@@ -179,7 +179,8 @@
* This user must exist.
*/
- if (!getpwnam (username)) { /* local, no need for xgetpwnam */
+ /* local, no need for xgetpwnam */
+ if (getpwnam (username) == NULL) {
fprintf (stderr, _("%s: unknown user %s\n"),
Prog, username);
errors++;
@@ -206,7 +207,7 @@
case 'a': /* add a user */
user = optarg;
/* local, no need for xgetpwnam */
- if (!getpwnam (user)) {
+ if (getpwnam (user) == NULL) {
fprintf (stderr,
_("%s: unknown user %s\n"), Prog,
user);
@@ -236,7 +237,7 @@
exit (2);
}
admins = optarg;
- if (check_list (admins)) {
+ if (check_list (admins) != 0) {
exit (1);
}
Aflg++;
@@ -258,7 +259,7 @@
failure ();
}
members = optarg;
- if (check_list (members)) {
+ if (check_list (members) != 0) {
exit (1);
}
Mflg++;
@@ -471,7 +472,7 @@
static void update_group (struct group *gr)
#endif
{
- if (!gr_update (gr)) {
+ if (gr_update (gr) == 0) {
fprintf (stderr, _("%s: can't update entry\n"), Prog);
SYSLOG ((LOG_WARN, "cannot update /etc/group"));
#ifdef WITH_AUDIT
@@ -481,7 +482,7 @@
exit (1);
}
#ifdef SHADOWGRP
- if (is_shadowgrp && !sgr_update (sg)) {
+ if (is_shadowgrp && (sgr_update (sg) == 0)) {
fprintf (stderr, _("%s: can't update shadow entry\n"), Prog);
SYSLOG ((LOG_WARN, "cannot update /etc/gshadow"));
#ifdef WITH_AUDIT
@@ -508,7 +509,7 @@
struct group const*tmpgr = NULL;
struct sgrp const*tmpsg = NULL;
- if (!gr_open (O_RDONLY)) {
+ if (gr_open (O_RDONLY) == 0) {
fprintf (stderr, _("%s: can't open file\n"), Prog);
SYSLOG ((LOG_WARN, "cannot open /etc/group"));
#ifdef WITH_AUDIT
@@ -533,7 +534,7 @@
gr->gr_passwd = xstrdup (tmpgr->gr_passwd);
gr->gr_mem = dup_list (tmpgr->gr_mem);
- if (!gr_close ()) {
+ if (gr_close () == 0) {
fprintf (stderr, _("%s: can't close file\n"), Prog);
SYSLOG ((LOG_WARN, "cannot close /etc/group"));
#ifdef WITH_AUDIT
@@ -544,7 +545,7 @@
}
#ifdef SHADOWGRP
- if (!sgr_open (O_RDONLY)) {
+ if (sgr_open (O_RDONLY) == 0) {
fprintf (stderr, _("%s: can't open shadow file\n"), Prog);
SYSLOG ((LOG_WARN, "cannot open /etc/gshadow"));
#ifdef WITH_AUDIT
@@ -572,15 +573,15 @@
#ifdef FIRST_MEMBER_IS_ADMIN
if (sg->sg_mem[0]) {
sg->sg_adm[0] = xstrdup (sg->sg_mem[0]);
- sg->sg_adm[1] = 0;
+ sg->sg_adm[1] = NULL;
} else
#endif
{
- sg->sg_adm[0] = 0;
+ sg->sg_adm[0] = NULL;
}
}
- if (!sgr_close ()) {
+ if (sgr_close () == 0) {
fprintf (stderr, _("%s: can't close shadow file\n"), Prog);
SYSLOG ((LOG_WARN, "cannot close /etc/gshadow"));
#ifdef WITH_AUDIT
@@ -727,7 +728,7 @@
*/
pw = get_my_pwent ();
- if (!pw) {
+ if (NULL == pw) {
fprintf (stderr, _("Who are you?\n"));
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "user lookup", NULL,
@@ -887,7 +888,7 @@
* be a tty. The typical keyboard signals are caught so the termio
* modes can be restored.
*/
- if (!isatty (0) || !isatty (1)) {
+ if ((isatty (0) == 0) || (isatty (1) == 0)) {
fprintf (stderr, _("%s: Not a tty\n"), Prog);
#ifdef WITH_AUDIT
audit_logger (AUDIT_USER_CHAUTHTOK, Prog, "changing password",
@@ -920,7 +921,7 @@
* output, etc.
*/
output:
- if (setuid (0)) {
+ if (setuid (0) != 0) {
fprintf (stderr, _("Cannot change ID to root.\n"));
SYSLOG ((LOG_ERR, "can't setuid(0)"));
#ifdef WITH_AUDIT
More information about the Pkg-shadow-commits
mailing list