From d92df0803d1c38c13e092e4e5e0cb7be09bcc737 Mon Sep 17 00:00:00 2001 From: Alain Spineux Date: Thu, 3 Dec 2020 14:36:33 +0100 Subject: [PATCH] Restore custom permission of symlink on FreeBSD and MacOS - 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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bacula/src/findlib/attribs.c b/bacula/src/findlib/attribs.c index c39c4647d..7ed8d590e 100644 --- a/bacula/src/findlib/attribs.c +++ b/bacula/src/findlib/attribs.c @@ -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; -- 2.47.3