* The #ifdefing is a bit ugly, but it is the only
* way we can ensure this works on older systems.
*/
-#ifdef HAVE_FCHMOD
- if (fchmod(ofd->fid, attr->statp.st_mode) < 0 && print_error) {
+#ifdef HAVE_FCHOWN
+ if (fchown(ofd->fid, attr->statp.st_uid, attr->statp.st_gid) < 0 && print_error) {
#else
- if (lchmod(attr->ofname, attr->statp.st_mode) < 0 && print_error) {
+ if (lchown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0 && print_error) {
#endif
berrno be;
- Jmsg2(jcr, M_ERROR, 0, _("Unable to set file modes %s: ERR=%s\n"),
+ Jmsg2(jcr, M_ERROR, 0, _("Unable to set file owner %s: ERR=%s\n"),
attr->ofname, be.bstrerror());
ok = false;
}
-#ifdef HAVE_FCHOWN
- if (fchown(ofd->fid, attr->statp.st_uid, attr->statp.st_gid) < 0 && print_error) {
+#ifdef HAVE_FCHMOD
+ if (fchmod(ofd->fid, attr->statp.st_mode) < 0 && print_error) {
#else
- if (lchown(attr->ofname, attr->statp.st_uid, attr->statp.st_gid) < 0 && print_error) {
+ if (lchmod(attr->ofname, attr->statp.st_mode) < 0 && print_error) {
#endif
berrno be;
- Jmsg2(jcr, M_ERROR, 0, _("Unable to set file owner %s: ERR=%s\n"),
+ Jmsg2(jcr, M_ERROR, 0, _("Unable to set file modes %s: ERR=%s\n"),
attr->ofname, be.bstrerror());
ok = false;
}