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;
}
}
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;
}
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;
}
}
* 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;
}
* 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);
}
#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;
}
#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;
}
{
/* 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) {
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;
}
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;
}