* Avoid assignment in comparisons, implicit comparison of integers to booleans.

* The return value of closedir is not checked on purpose.
* Add brackets.
This commit is contained in:
nekral-guest 2008-05-25 21:23:28 +00:00
parent 623d9e2ab3
commit 06d2a32a3e
2 changed files with 18 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2008-05-25 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/chowndir.c: Avoid assignment in comparisons, implicit
comparison of integers to booleans.
* libmisc/chowndir.c: The return value of closedir is not checked
on purpose.
* libmisc/chowndir.c: Add brackets.
2008-05-25 Nicolas François <nicolas.francois@centraliens.net> 2008-05-25 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/chkname.h, libmisc/chkname.c: check_group_name (resp. * libmisc/chkname.h, libmisc/chkname.c: check_group_name (resp.

View File

@ -104,9 +104,11 @@ chown_tree (const char *root, uid_t old_uid, uid_t new_uid, gid_t old_gid,
* Do the entire subdirectory. * Do the entire subdirectory.
*/ */
if ((rc = chown_tree (new_name, old_uid, new_uid, rc = chown_tree (new_name, old_uid, new_uid,
old_gid, new_gid))) old_gid, new_gid);
if (0 != rc) {
break; break;
}
} }
#ifndef HAVE_LCHOWN #ifndef HAVE_LCHOWN
/* don't use chown (follows symbolic links!) */ /* don't use chown (follows symbolic links!) */
@ -117,16 +119,18 @@ chown_tree (const char *root, uid_t old_uid, uid_t new_uid, gid_t old_gid,
LCHOWN (new_name, new_uid, LCHOWN (new_name, new_uid,
sb.st_gid == old_gid ? new_gid : sb.st_gid); sb.st_gid == old_gid ? new_gid : sb.st_gid);
} }
closedir (dir); (void) closedir (dir);
/* /*
* Now do the root of the tree * Now do the root of the tree
*/ */
if (!stat (root, &sb)) { if (stat (root, &sb) == 0) {
if (sb.st_uid == old_uid) if (sb.st_uid == old_uid) {
LCHOWN (root, new_uid, LCHOWN (root, new_uid,
sb.st_gid == old_gid ? new_gid : sb.st_gid); sb.st_gid == old_gid ? new_gid : sb.st_gid);
}
} }
return rc; return rc;
} }