diff options
author | Wayne Davison <wayned@samba.org> | 2008-02-07 07:24:58 -0800 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2008-02-07 07:24:58 -0800 |
commit | 87629cf2f61f98b7030e5c18d54490a0cb676f0e (patch) | |
tree | b215042d6ef993b4222d0c894ef1ee6d1d24cb74 | |
parent | e7f642cffe6356d29599fc8737eb01f1b4ea2df5 (diff) | |
download | rsync-87629cf2f61f98b7030e5c18d54490a0cb676f0e.tar.gz rsync-87629cf2f61f98b7030e5c18d54490a0cb676f0e.tar.bz2 rsync-87629cf2f61f98b7030e5c18d54490a0cb676f0e.zip |
Re-indent some code in set_file_attrs() to make the flow clearer.
-rw-r--r-- | rsync.c | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -422,24 +422,24 @@ int set_file_attrs(const char *fname, struct file_struct *file, stat_x *sxp, fname, (unsigned)sxp->st.st_gid, F_GROUP(file)); } } - if (am_root < 0) { - ; - } else if (do_lchown(fname, - change_uid ? (uid_t)F_OWNER(file) : sxp->st.st_uid, - change_gid ? (gid_t)F_GROUP(file) : sxp->st.st_gid) != 0) { - /* shouldn't have attempted to change uid or gid - * unless have the privilege */ - rsyserr(FERROR_XFER, errno, "%s %s failed", - change_uid ? "chown" : "chgrp", - full_fname(fname)); - goto cleanup; - } else - /* a lchown had been done - we have to re-stat if the - * destination had the setuid or setgid bits set due - * to the side effect of the chown call */ - if (sxp->st.st_mode & (S_ISUID | S_ISGID)) { - link_stat(fname, &sxp->st, - keep_dirlinks && S_ISDIR(sxp->st.st_mode)); + if (am_root >= 0) { + if (do_lchown(fname, + change_uid ? (uid_t)F_OWNER(file) : sxp->st.st_uid, + change_gid ? (gid_t)F_GROUP(file) : sxp->st.st_gid) != 0) { + /* We shouldn't have attempted to change uid + * or gid unless have the privilege. */ + rsyserr(FERROR_XFER, errno, "%s %s failed", + change_uid ? "chown" : "chgrp", + full_fname(fname)); + goto cleanup; + } + /* A lchown had been done, so we need to re-stat if + * the destination had the setuid or setgid bits set + * (due to the side effect of the chown call). */ + if (sxp->st.st_mode & (S_ISUID | S_ISGID)) { + link_stat(fname, &sxp->st, + keep_dirlinks && S_ISDIR(sxp->st.st_mode)); + } } updated = 1; } |