]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Restore custom permission of symlink on FreeBSD and MacOS
authorAlain Spineux <alain@baculasystems.com>
Thu, 3 Dec 2020 13:36:33 +0000 (14:36 +0100)
committerEric Bollengier <eric@baculasystems.com>
Sat, 12 Dec 2020 15:35:44 +0000 (16:35 +0100)
- FreeBSD and MacOS have a lchmod() system call and a chmod with
  option -h that allow to chnage the permission of o symlink
  instead of having a fixed lrwxrwxrwx, these system can have
  a custom one.

bacula/src/findlib/attribs.c

index c39c4647d13a3b0b193bf96e27f971de29640e5d..7ed8d590e41b30d5a0b42eac189a47e9add31cf5 100644 (file)
@@ -645,6 +645,14 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd)
          ok = false;
       }
 #endif
+#ifdef HAVE_LCHMOD
+      if (lchmod(attr->ofname, attr->statp.st_mode) < 0 && print_error(jcr)) {
+         berrno be;
+         Jmsg2(jcr, M_ERROR, 0, _("Unable to set file modes %s: ERR=%s\n"),
+            attr->ofname, be.bstrerror());
+         ok = false;
+      }
+#endif
 #ifdef HAVE_LUTIMES
       struct timeval times[2];
       times[0].tv_sec = attr->statp.st_atime;