From: Alain Spineux Date: Thu, 3 Dec 2020 13:36:33 +0000 (+0100) Subject: Restore custom permission of symlink on FreeBSD and MacOS X-Git-Tag: Release-9.6.7~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=105a46e5a54196786765adaa9b20816a2a3e95b2;p=thirdparty%2Fbacula.git 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. --- diff --git a/bacula/src/findlib/attribs.c b/bacula/src/findlib/attribs.c index 102422330..73ee73e3f 100644 --- a/bacula/src/findlib/attribs.c +++ b/bacula/src/findlib/attribs.c @@ -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;