uint32_t expected_serialize_len = 0;
char *xattr_list, *bp;
xattr_t *xattr_value_list, *current_xattr;
+ berrno be;
/*
* First get the length of the available list with extended attributes.
case ENOENT:
return bsub_exit_nok;
default:
- berrno be;
Jmsg2(jcr, M_ERROR, 0, _("llistxattr error on file \"%s\": ERR=%s\n"),
jcr->last_fname, be.bstrerror());
Dmsg2(100, "llistxattr error file=%s ERR=%s\n",
free(xattr_list);
return bsub_exit_nok;
default:
- berrno be;
Jmsg2(jcr, M_ERROR, 0, _("llistxattr error on file \"%s\": ERR=%s\n"),
jcr->last_fname, be.bstrerror());
Dmsg2(100, "llistxattr error file=%s ERR=%s\n",
case ENOENT:
goto bail_out;
default:
- berrno be;
Jmsg2(jcr, M_ERROR, 0, _("lgetxattr error on file \"%s\": ERR=%s\n"),
jcr->last_fname, be.bstrerror());
Dmsg2(100, "lgetxattr error file=%s ERR=%s\n",
case ENOENT:
goto bail_out;
default:
- berrno be;
Jmsg2(jcr, M_ERROR, 0, _("lgetxattr error on file \"%s\": ERR=%s\n"),
jcr->last_fname, be.bstrerror());
Dmsg2(100, "lgetxattr error file=%s ERR=%s\n",
unser_declare;
xattr_t current_xattr;
bsub_exit_code retval = bsub_exit_nok;
+ berrno be;
/*
* Parse the stream and perform the setxattr calls on the file.
break;
default:
current_xattr.value_length, 0) != 0) {
- berrno be;
Jmsg2(jcr, M_ERROR, 0, _("lsetxattr error on file \"%s\": ERR=%s\n"),
jcr->last_fname, be.bstrerror());
Dmsg2(100, "lsetxattr error file=%s ERR=%s\n",
#ifdef HAVE_EXTENDED_ACL
int flags;
acl_t *aclp = NULL;
+ berrno be;
/*
* See if this attribute has an ACL
case ENOENT:
return bsub_exit_nok;
default:
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to get acl on xattr %s on file \"%s\": ERR=%s\n"),
attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "facl_get/acl_get of xattr %s on \"%s\" failed: ERR=%s\n",
#else /* HAVE_EXTENDED_ACL */
int n;
aclent_t *acls = NULL;
+ berrno be;
/*
* See if this attribute has an ACL
free(acls);
return bsub_exit_nok;
default:
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to get acl on xattr %s on file \"%s\": ERR=%s\n"),
attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "facl/acl of xattr %s on \"%s\" failed: ERR=%s\n",
*/
if (!acl_is_trivial(n, acls)) {
if ((*acl_text = acltotext(acls, n)) == NULL) {
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to get acl text on xattr %s on file \"%s\": ERR=%s\n"),
attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "acltotext of xattr %s on \"%s\" failed: ERR=%s\n",
char attribs[MAXSTRING];
char buffer[BUFSIZ];
bsub_exit_code retval = bsub_exit_nok;
+ berrno be;
snprintf(target_attrname, sizeof(target_attrname), "%s%s", xattr_namespace, attrname);
case ENOENT:
goto cleanup;
default:
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to get status on xattr %s on file \"%s\": ERR=%s\n"),
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "fstatat of xattr %s on \"%s\" failed: ERR=%s\n",
case ENOENT:
goto cleanup;
default:
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to open xattr %s on \"%s\": ERR=%s\n"),
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "openat of xattr %s on \"%s\" failed: ERR=%s\n",
case ENOENT:
goto cleanup;
default:
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to read symlin %s on \"%s\": ERR=%s\n"),
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "readlink of xattr %s on \"%s\" failed: ERR=%s\n",
case ENOENT:
goto cleanup;
default:
- berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to chdir to xattr space of file \"%s\": ERR=%s\n"),
jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to fchdir to xattr space of file \"%s\" using fd %d: ERR=%s\n",
struct dirent *dp;
char current_xattr_namespace[PATH_MAX];
bsub_exit_code retval = bsub_exit_nok;
+ berrno be;
/*
* Determine what argument to use. Use attr_parent when set
case ENOENT:
goto cleanup;
default:
- berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to open file \"%s\": ERR=%s\n"),
jcr->last_fname, be.bstrerror());
Dmsg2(100, "Unable to open file \"%s\": ERR=%s\n",
case ENOENT:
goto cleanup;
default:
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to open xattr space %s on file \"%s\": ERR=%s\n"),
name, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to open xattr space %s on file \"%s\": ERR=%s\n",
* attributes should be saved.
*/
if (fchdir(attrdirfd) < 0) {
- berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to chdir to xattr space on file \"%s\": ERR=%s\n"),
jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to fchdir to xattr space on file \"%s\" using fd %d: ERR=%s\n",
if ((fd = dup(attrdirfd)) == -1 ||
(dirp = fdopendir(fd)) == (DIR *)NULL) {
- berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to list the xattr space on file \"%s\": ERR=%s\n"),
jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to fdopendir xattr space on file \"%s\" using fd %d: ERR=%s\n",
#ifdef HAVE_EXTENDED_ACL
int error;
acl_t *aclp = NULL;
+ berrno be;
if ((error = acl_fromtext(acl_text, &aclp)) != 0) {
Jmsg1(jcr, M_ERROR, 0, _("Unable to convert acl from text on file \"%s\"\n"),
if ((fd != -1 && facl_set(fd, aclp) != 0) ||
acl_set(attrname, aclp) != 0) {
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to restore acl of xattr %s on file \"%s\": ERR=%s\n"),
attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to restore acl of xattr %s on file \"%s\": ERR=%s\n",
#else /* HAVE_EXTENDED_ACL */
int n;
aclent_t *acls = NULL;
+ berrno be;
acls = aclfromtext(acl_text, &n);
if (!acls) {
if ((fd != -1 && facl(fd, SETACL, n, acls) != 0) ||
acl(attrname, SETACL, n, acls) != 0) {
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to restore acl of xattr %s on file \"%s\": ERR=%s\n"),
attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to restore acl of xattr %s on file \"%s\": ERR=%s\n",
struct stat st;
struct timeval times[2];
bsub_exit_code retval = bsub_exit_nok;
+ berrno be;
/*
* Parse the xattr stream. First the part that is the same for all xattrs.
* Open the file on which to restore the xattrs read-only.
*/
if ((filefd = open(jcr->last_fname, O_RDONLY | O_NONBLOCK)) < 0) {
- berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to open file \"%s\": ERR=%s\n"),
jcr->last_fname, be.bstrerror());
Dmsg2(100, "Unable to open file \"%s\": ERR=%s\n",
* Open the xattr naming space and make it the current working dir.
*/
if ((attrdirfd = openat(filefd, ".", O_RDONLY | O_XATTR)) < 0) {
- berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to open xattr space on file \"%s\": ERR=%s\n"),
jcr->last_fname, be.bstrerror());
Dmsg2(100, "Unable to open xattr space on file \"%s\": ERR=%s\n",
}
if (fchdir(attrdirfd) < 0) {
- berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to chdir to xattr space on file \"%s\": ERR=%s\n"),
jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to fchdir to xattr space on file \"%s\" using fd %d: ERR=%s\n",
*bp = '\0';
if ((fd = open(target_attrname, O_RDONLY | O_NONBLOCK)) < 0) {
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to open xattr %s on file \"%s\": ERR=%s\n"),
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to open xattr %s on file \"%s\": ERR=%s\n",
* Open the xattr naming space.
*/
if ((fd = openat(filefd, ".", O_RDONLY | O_XATTR)) < 0) {
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to open xattr space %s on file \"%s\": ERR=%s\n"),
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to open xattr space %s on file \"%s\": ERR=%s\n",
* Make the xattr space our current workingdir.
*/
if (fchdir(attrdirfd) < 0) {
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to chdir to xattr space %s on file \"%s\": ERR=%s\n"),
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg4(100, "Unable to fchdir to xattr space %s on file \"%s\" using fd %d: ERR=%s\n",
*/
unlinkat(attrdirfd, target_attrname, 0);
if (mkfifo(target_attrname, st.st_mode) < 0) {
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to mkfifo xattr %s on file \"%s\": ERR=%s\n"),
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to mkfifo xattr %s on file \"%s\": ERR=%s\n",
*/
unlinkat(attrdirfd, target_attrname, 0);
if (mknod(target_attrname, st.st_mode, st.st_rdev) < 0) {
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to mknod xattr %s on file \"%s\": ERR=%s\n"),
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to mknod xattr %s on file \"%s\": ERR=%s\n",
if (strcmp(target_attrname, ".")) {
unlinkat(attrdirfd, target_attrname, AT_REMOVEDIR);
if (mkdir(target_attrname, st.st_mode) < 0) {
- berrno be;
Jmsg3(jcr, M_WARNING, 0, _("Unable to mkdir xattr %s on file \"%s\": ERR=%s\n"),
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to mkdir xattr %s on file \"%s\": ERR=%s\n",
unlinkat(attrdirfd, target_attrname, 0);
if (link(linked_target, target_attrname) < 0) {
- berrno be;
Jmsg4(jcr, M_ERROR, 0, _("Unable to link xattr %s to %s on file \"%s\": ERR=%s\n"),
target_attrname, linked_target, jcr->last_fname, be.bstrerror());
Dmsg4(100, "Unable to link xattr %s to %s on file \"%s\": ERR=%s\n",
}
if ((attrfd = openat(attrdirfd, target_attrname, O_RDWR | O_CREAT | O_TRUNC, st.st_mode)) < 0) {
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to open xattr %s on file \"%s\": ERR=%s\n"),
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to open xattr %s on file \"%s\": ERR=%s\n",
while (cnt > 0) {
cnt = write(attrfd, data, cnt);
if (cnt < 0) {
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to restore data of xattr %s on file \"%s\": ERR=%s\n"),
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to restore data of xattr %s on file \"%s\": ERR=%s\n",
linked_target = bp;
if (symlink(linked_target, target_attrname) < 0) {
- berrno be;
Jmsg4(jcr, M_ERROR, 0, _("Unable to symlink xattr %s to %s on file \"%s\": ERR=%s\n"),
target_attrname, linked_target, jcr->last_fname, be.bstrerror());
Dmsg4(100, "Unable to symlink xattr %s to %s on file \"%s\": ERR=%s\n",
retval = bsub_exit_ok;
break;
default:
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to restore owner of xattr %s on file \"%s\": ERR=%s\n"),
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to restore owner of xattr %s on file \"%s\": ERR=%s\n",
times[1].tv_usec = 0;
if (futimesat(attrdirfd, target_attrname, times) < 0) {
- berrno be;
Jmsg3(jcr, M_ERROR, 0, _("Unable to restore filetimes of xattr %s on file \"%s\": ERR=%s\n"),
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to restore filetimes of xattr %s on file \"%s\": ERR=%s\n",