[Pkg-shadow-commits] r1519 - in upstream/trunk: . libmisc
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Fri Dec 28 00:03:27 UTC 2007
Author: nekral-guest
Date: 2007-12-28 00:03:26 +0000 (Fri, 28 Dec 2007)
New Revision: 1519
Modified:
upstream/trunk/ChangeLog
upstream/trunk/libmisc/copydir.c
Log:
Avoid implicit conversions to booleans.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2007-12-27 23:41:36 UTC (rev 1518)
+++ upstream/trunk/ChangeLog 2007-12-28 00:03:26 UTC (rev 1519)
@@ -10,6 +10,7 @@
* libmisc/copydir.c: Avoid assignment in comparisons.
* libmisc/copydir.c: Document selinux_file_context.
* libmisc/copydir.c: Avoid implicit brackets.
+ * libmisc/copydir.c: Avoid implicit conversions to booleans.
2007-12-27 Nicolas François <nicolas.francois at centraliens.net>
Modified: upstream/trunk/libmisc/copydir.c
===================================================================
--- upstream/trunk/libmisc/copydir.c 2007-12-27 23:41:36 UTC (rev 1518)
+++ upstream/trunk/libmisc/copydir.c 2007-12-28 00:03:26 UTC (rev 1519)
@@ -92,13 +92,13 @@
if (selinux_enabled) {
/* Get the default security context for this file */
if (matchpathcon (dst_name, 0, &scontext) < 0) {
- if (security_getenforce ()) {
+ if (security_getenforce () != 0) {
return 1;
}
}
/* Set the security context for the next created file */
if (setfscreatecon (scontext) < 0) {
- if (security_getenforce ()) {
+ if (security_getenforce () != 0) {
return 1;
}
}
@@ -121,13 +121,13 @@
free (ln);
return;
}
- for (lp = links; lp; lp = lp->ln_next) {
+ for (lp = links; NULL !=lp; lp = lp->ln_next) {
if (lp->ln_next == ln) {
break;
}
}
- if (!lp) {
+ if (NULL == lp) {
return;
}
@@ -149,7 +149,7 @@
int len;
for (lp = links; lp; lp = lp->ln_next) {
- if (lp->ln_dev == sb->st_dev && lp->ln_ino == sb->st_ino) {
+ if ((lp->ln_dev == sb->st_dev) && (lp->ln_ino == sb->st_ino)) {
return lp;
}
}
@@ -195,7 +195,8 @@
* target is created. It assumes the target directory exists.
*/
- if (access (src_root, F_OK) != 0 || access (dst_root, F_OK) != 0) {
+ if ( (access (src_root, F_OK) != 0)
+ || (access (dst_root, F_OK) != 0)) {
return -1;
}
@@ -300,7 +301,7 @@
* See if this is a previously copied link
*/
- else if ((lp = check_link (src, &sb))) {
+ else if ((lp = check_link (src, &sb)) != NULL) {
err = copy_hardlink (src, dst, lp);
}
@@ -341,13 +342,13 @@
#ifdef WITH_SELINUX
selinux_file_context (dst);
#endif
- if (mkdir (dst, statp->st_mode)
- || chown (dst,
- uid == (uid_t) - 1 ? statp->st_uid : uid,
- gid == (gid_t) - 1 ? statp->st_gid : gid)
- || chmod (dst, statp->st_mode)
- || copy_tree (src, dst, uid, gid)
- || utimes (dst, mt)) {
+ if ( (mkdir (dst, statp->st_mode) != 0)
+ || (chown (dst,
+ (uid == (uid_t) - 1) ? statp->st_uid : uid,
+ (gid == (gid_t) - 1) ? statp->st_gid : gid) != 0)
+ || (chmod (dst, statp->st_mode) != 0)
+ || (copy_tree (src, dst, uid, gid) != 0)
+ || (utimes (dst, mt) != 0)) {
err = -1;
}
@@ -386,10 +387,10 @@
#ifdef WITH_SELINUX
selinux_file_context (dst);
#endif
- if (symlink (oldlink, dst)
- || lchown (dst,
- uid == (uid_t) - 1 ? statp->st_uid : uid,
- gid == (gid_t) - 1 ? statp->st_gid : gid)) {
+ if ( (symlink (oldlink, dst) != 0)
+ || (lchown (dst,
+ uid == (uid_t) - 1 ? statp->st_uid : uid,
+ gid == (gid_t) - 1 ? statp->st_gid : gid) != 0)) {
return -1;
}
@@ -409,10 +410,10 @@
{
/* TODO: selinux needed? */
- if (link (lp->ln_name, dst)) {
+ if (link (lp->ln_name, dst) != 0) {
return -1;
}
- if (unlink (src)) {
+ if (unlink (src) != 0) {
return -1;
}
if (--lp->ln_count <= 0) {
@@ -432,12 +433,12 @@
selinux_file_context (dst);
#endif
- if (mknod (dst, statp->st_mode & ~07777, statp->st_rdev)
- || chown (dst,
- uid == (uid_t) - 1 ? statp->st_uid : uid,
- gid == (gid_t) - 1 ? statp->st_gid : gid)
- || chmod (dst, statp->st_mode & 07777)
- || utimes (dst, mt)) {
+ if ( (mknod (dst, statp->st_mode & ~07777, statp->st_rdev) != 0)
+ || (chown (dst,
+ (uid == (uid_t) - 1) ? statp->st_uid : uid,
+ (gid == (gid_t) - 1) ? statp->st_gid : gid) != 0)
+ || (chmod (dst, statp->st_mode & 07777) != 0)
+ || (utimes (dst, mt) != 0)) {
err = -1;
}
@@ -462,11 +463,11 @@
selinux_file_context (dst);
#endif
ofd = open (dst, O_WRONLY | O_CREAT | O_TRUNC, 0);
- if ((ofd < 0)
- || chown (dst,
- uid == (uid_t) - 1 ? statp->st_uid : uid,
- gid == (gid_t) - 1 ? statp->st_gid : gid)
- || chmod (dst, statp->st_mode & 07777)) {
+ if ( (ofd < 0)
+ || (chown (dst,
+ (uid == (uid_t) - 1) ? statp->st_uid : uid,
+ (gid == (gid_t) - 1) ? statp->st_gid : gid) != 0)
+ || (chmod (dst, statp->st_mode & 07777) != 0)) {
close (ifd);
return -1;
}
More information about the Pkg-shadow-commits
mailing list