[Pkg-shadow-commits] r1621 - in upstream/trunk: . lib
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Tue Jan 1 22:21:55 UTC 2008
Author: nekral-guest
Date: 2008-01-01 22:21:55 +0000 (Tue, 01 Jan 2008)
New Revision: 1621
Modified:
upstream/trunk/ChangeLog
upstream/trunk/lib/shadow.c
Log:
Avoid assignments in conditionals.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2008-01-01 20:47:31 UTC (rev 1620)
+++ upstream/trunk/ChangeLog 2008-01-01 22:21:55 UTC (rev 1621)
@@ -1,5 +1,9 @@
2008-01-01 Nicolas François <nicolas.francois at centraliens.net>
+ * lib/shadow.c: Avoid assignments in conditionals.
+
+2008-01-01 Nicolas François <nicolas.francois at centraliens.net>
+
* lib/groupio.c (split_groups): Test the pointer returned by malloc.
2008-01-01 Nicolas François <nicolas.francois at centraliens.net>
Modified: upstream/trunk/lib/shadow.c
===================================================================
--- upstream/trunk/lib/shadow.c 2008-01-01 20:47:31 UTC (rev 1620)
+++ upstream/trunk/lib/shadow.c 2008-01-01 22:21:55 UTC (rev 1621)
@@ -135,7 +135,8 @@
return 0;
strcpy (spwbuf, string);
- if ((cp = strrchr (spwbuf, '\n')))
+ cp = strrchr (spwbuf, '\n');
+ if (NULL != cp)
*cp = '\0';
/*
@@ -178,7 +179,8 @@
* incorrectly formatted number, unless we are using NIS.
*/
- if ((spwd.sp_lstchg = strtol (fields[2], &cpp, 10)) == 0 && *cpp) {
+ spwd.sp_lstchg = strtol (fields[2], &cpp, 10);
+ if ((spwd.sp_lstchg == 0) && *cpp) {
#ifdef USE_NIS
if (!nis_used)
return 0;
@@ -194,7 +196,8 @@
* Get the minimum period between password changes.
*/
- if ((spwd.sp_min = strtol (fields[3], &cpp, 10)) == 0 && *cpp) {
+ spwd.sp_min = strtol (fields[3], &cpp, 10);
+ if ((spwd.sp_min == 0) && *cpp) {
#ifdef USE_NIS
if (!nis_used)
return 0;
@@ -210,7 +213,8 @@
* Get the maximum number of days a password is valid.
*/
- if ((spwd.sp_max = strtol (fields[4], &cpp, 10)) == 0 && *cpp) {
+ spwd.sp_max = strtol (fields[4], &cpp, 10);
+ if ((spwd.sp_max == 0) && *cpp) {
#ifdef USE_NIS
if (!nis_used)
return 0;
@@ -238,7 +242,8 @@
* Get the number of days of password expiry warning.
*/
- if ((spwd.sp_warn = strtol (fields[5], &cpp, 10)) == 0 && *cpp) {
+ spwd.sp_warn = strtol (fields[5], &cpp, 10);
+ if ((spwd.sp_warn == 0) && *cpp) {
#ifdef USE_NIS
if (!nis_used)
return 0;
@@ -255,7 +260,8 @@
* disabled.
*/
- if ((spwd.sp_inact = strtol (fields[6], &cpp, 10)) == 0 && *cpp) {
+ spwd.sp_inact = strtol (fields[6], &cpp, 10);
+ if ((spwd.sp_inact == 0) && *cpp) {
#ifdef USE_NIS
if (!nis_used)
return 0;
@@ -272,7 +278,8 @@
* set to expire.
*/
- if ((spwd.sp_expire = strtol (fields[7], &cpp, 10)) == 0 && *cpp) {
+ spwd.sp_expire = strtol (fields[7], &cpp, 10);
+ if ((spwd.sp_expire == 0) && *cpp) {
#ifdef USE_NIS
if (!nis_used)
return 0;
@@ -289,7 +296,8 @@
* to have anything other than a valid integer in it.
*/
- if ((spwd.sp_flag = strtol (fields[8], &cpp, 10)) == 0 && *cpp) {
+ spwd.sp_flag = strtol (fields[8], &cpp, 10);
+ if ((spwd.sp_flag == 0) && *cpp) {
#ifdef USE_NIS
if (!nis_used)
return 0;
@@ -322,7 +330,8 @@
if (fgets (buf, sizeof buf, fp) != (char *) 0)
#endif
{
- if ((cp = strchr (buf, '\n')))
+ cp = strchr (buf, '\n');
+ if (NULL != cp)
*cp = '\0';
#ifdef USE_NIS
if (nis_ignore && IS_NISCHAR (buf[0]))
@@ -360,7 +369,8 @@
* right away if there is none.
*/
- if (!(val = fgetspent (shadow)))
+ val = fgetspent (shadow);
+ if (NULL == val)
return 0;
/*
@@ -456,11 +466,13 @@
if (yp_match (nis_domain, "shadow.byname", name,
strlen (name), &nis_val, &nis_vallen) == 0) {
- if (cp = strchr (nis_val, '\n'))
+ cp = strchr (nis_val, '\n');
+ if (NULL != cp)
*cp = '\0';
nis_state = middle;
- if ((sp = my_sgetspent (nis_val))) {
+ sp = my_sgetspent (nis_val);
+ if (NULL != sp) {
strcpy (save_name, sp->sp_namp);
nis_key = save_name;
nis_keylen = strlen (save_name);
More information about the Pkg-shadow-commits
mailing list