]> 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)
committerAlain Spineux <alain@baculasystems.com>
Thu, 3 Dec 2020 16:19:40 +0000 (17:19 +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 10242233025626ef4c31cf7966e20aea031ace20..73ee73e3fd22354b573bbdea54f0d47a3c82615d 100644 (file)
@@ -640,6 +640,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;