Commit 87629cf2 authored by Wayne Davison's avatar Wayne Davison

Re-indent some code in set_file_attrs() to make the flow clearer.

parent e7f642cf
...@@ -422,25 +422,25 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp, ...@@ -422,25 +422,25 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp,
fname, (unsigned)sxp->st.st_gid, F_GROUP(file)); fname, (unsigned)sxp->st.st_gid, F_GROUP(file));
} }
} }
if (am_root < 0) { if (am_root >= 0) {
; if (do_lchown(fname,
} else if (do_lchown(fname,
change_uid ? (uid_t)F_OWNER(file) : sxp->st.st_uid, change_uid ? (uid_t)F_OWNER(file) : sxp->st.st_uid,
change_gid ? (gid_t)F_GROUP(file) : sxp->st.st_gid) != 0) { change_gid ? (gid_t)F_GROUP(file) : sxp->st.st_gid) != 0) {
/* shouldn't have attempted to change uid or gid /* We shouldn't have attempted to change uid
* unless have the privilege */ * or gid unless have the privilege. */
rsyserr(FERROR_XFER, errno, "%s %s failed", rsyserr(FERROR_XFER, errno, "%s %s failed",
change_uid ? "chown" : "chgrp", change_uid ? "chown" : "chgrp",
full_fname(fname)); full_fname(fname));
goto cleanup; goto cleanup;
} else }
/* a lchown had been done - we have to re-stat if the /* A lchown had been done, so we need to re-stat if
* destination had the setuid or setgid bits set due * the destination had the setuid or setgid bits set
* to the side effect of the chown call */ * (due to the side effect of the chown call). */
if (sxp->st.st_mode & (S_ISUID | S_ISGID)) { if (sxp->st.st_mode & (S_ISUID | S_ISGID)) {
link_stat(fname, &sxp->st, link_stat(fname, &sxp->st,
keep_dirlinks && S_ISDIR(sxp->st.st_mode)); keep_dirlinks && S_ISDIR(sxp->st.st_mode));
} }
}
updated = 1; updated = 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment