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-11.0.0~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d92df0803d1c38c13e092e4e5e0cb7be09bcc737;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 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;