uint32_t expected_serialize_len = 0;
char *xattr_list, *bp;
xattr_t *xattr_value_list = NULL, *current_xattr;
+ bsub_exit_code retval = bsub_exit_nok;
berrno be;
/*
if (xattr_list_len < 0) {
switch (errno) {
case ENOENT:
- return bsub_exit_nok;
+ return bsub_exit_ok;
default:
Mmsg2(jcr->errmsg, _("llistxattr error on file \"%s\": ERR=%s\n"),
jcr->last_fname, be.bstrerror());
if (xattr_list_len < 0) {
switch (errno) {
case ENOENT:
- free(xattr_list);
- return bsub_exit_nok;
+ retval = bsub_exit_ok;
+ goto bail_out;
default:
Mmsg2(jcr->errmsg, _("llistxattr error on file \"%s\": ERR=%s\n"),
jcr->last_fname, be.bstrerror());
Dmsg2(100, "llistxattr error file=%s ERR=%s\n",
jcr->last_fname, be.bstrerror());
- free(xattr_list);
- return bsub_exit_nok;
+ goto bail_out;
}
}
xattr_list[xattr_list_len] = '\0';
if (xattr_value_len < 0) {
switch (errno) {
case ENOENT:
+ retval = bsub_exit_ok;
goto bail_out;
default:
Mmsg2(jcr->errmsg, _("lgetxattr error on file \"%s\": ERR=%s\n"),
if (xattr_value_len < 0) {
switch (errno) {
case ENOENT:
+ retval = bsub_exit_ok;
goto bail_out;
default:
Mmsg2(jcr->errmsg, _("lgetxattr error on file \"%s\": ERR=%s\n"),
xattr_drop_internal_table(xattr_value_list);
}
free(xattr_list);
- return bsub_exit_nok;
+ return retval;
}
static bsub_exit_code generic_xattr_parse_streams(JCR *jcr, int stream)
{
unser_declare;
xattr_t current_xattr;
- bsub_exit_code retval = bsub_exit_nok;
+ bsub_exit_code retval = bsub_exit_ok;
berrno be;
/*
jcr->last_fname, be.bstrerror());
Dmsg2(100, "lsetxattr error file=%s ERR=%s\n",
jcr->last_fname, be.bstrerror());
+ retval = bsub_exit_nok;
break;
}
}
fattr = name_to_attr(name);
} else {
retval = true;
- goto cleanup;
+ goto bail_out;
}
type = nvpair_type(pair);
if (value && fattr != F_ARCHIVE &&
fattr != F_AV_MODIFIED) {
retval = true;
- goto cleanup;
+ goto bail_out;
}
break;
case DATA_TYPE_UINT64_ARRAY:
if (fattr != F_CRTIME) {
retval = true;
- goto cleanup;
+ goto bail_out;
}
break;
case DATA_TYPE_NVLIST:
default:
retval = true;
- goto cleanup;
+ goto bail_out;
}
}
-cleanup:
+bail_out:
if (response != NULL) {
nvlist_free(response);
}
acl_get(attrname, ACL_NO_TRIVIAL, &aclp) != 0) {
switch (errno) {
case ENOENT:
- return bsub_exit_nok;
+ return bsub_exit_ok;
default:
Mmsg3(jcr->errmsg, _("Unable to get acl on xattr %s on file \"%s\": ERR=%s\n"),
attrname, jcr->last_fname, be.bstrerror());
switch (errno) {
case ENOENT:
free(acls);
- return bsub_exit_nok;
+ return bsub_exit_ok;
default:
Mmsg3(jcr->errmsg, _("Unable to get acl on xattr %s on file \"%s\": ERR=%s\n"),
attrname, jcr->last_fname, be.bstrerror());
if (fstatat(fd, attrname, &st, AT_SYMLINK_NOFOLLOW) < 0) {
switch (errno) {
case ENOENT:
- goto cleanup;
+ retval = bsub_exit_ok;
+ goto bail_out;
default:
Mmsg3(jcr->errmsg, _("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",
target_attrname, jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
}
* Get any acl on the xattr.
*/
if (solaris_save_xattr_acl(jcr, attrfd, attrname, &acl_text) != bsub_exit_ok)
- goto cleanup;
+ goto bail_out;
/*
* The current implementation of xattr on Solaris doesn't support this, but if it ever does we are prepared.
* Get any acl on the xattr.
*/
if (solaris_save_xattr_acl(jcr, attrfd, attrname, &acl_text) != bsub_exit_ok)
- goto cleanup;
+ goto bail_out;
/*
* See if this is the toplevel_hidden_dir being saved.
"%s%c%s%c%s%c",
target_attrname, 0, attribs, 0,
(acl_text) ? acl_text : "", 0);
- goto cleanup;
+ goto bail_out;
} else {
/*
* The current implementation of xattr on Solaris doesn't support this, but if it ever does we are prepared.
/*
* For a hard linked file we are ready now, no need to recursively save the attributes.
*/
- goto cleanup;
+ goto bail_out;
}
/*
* Get any acl on the xattr.
*/
if (solaris_save_xattr_acl(jcr, attrfd, attrname, &acl_text) != bsub_exit_ok) {
- goto cleanup;
+ goto bail_out;
}
/*
if ((attrfd = openat(fd, attrname, O_RDONLY)) < 0) {
switch (errno) {
case ENOENT:
- goto cleanup;
+ retval = bsub_exit_ok;
+ goto bail_out;
default:
Mmsg3(jcr->errmsg, _("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",
target_attrname, jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
}
break;
if (readlink(attrname, link_source, sizeof(link_source)) < 0) {
switch (errno) {
case ENOENT:
- goto cleanup;
+ retval = bsub_exit_ok;
+ goto bail_out;
default:
Mmsg3(jcr->errmsg, _("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",
target_attrname, jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
}
/*
* For a soft linked file we are ready now, no need to recursively save the attributes.
*/
- goto cleanup;
+ goto bail_out;
default:
- goto cleanup;
+ goto bail_out;
}
/*
if (st.st_size >= MAX_XATTR_STREAM) {
Mmsg2(jcr->errmsg, _("Xattr stream on file \"%s\" exceeds maximum size of %d bytes\n"),
jcr->last_fname, MAX_XATTR_STREAM);
- goto cleanup;
+ goto bail_out;
}
while ((cnt = read(attrfd, buffer, sizeof(buffer))) > 0) {
target_attrname, jcr->last_fname);
Dmsg2(100, "read of data from xattr %s on \"%s\" failed\n",
target_attrname, jcr->last_fname);
- goto cleanup;
+ goto bail_out;
}
}
break;
if (fchdir(fd) < 0) {
switch (errno) {
case ENOENT:
- goto cleanup;
+ retval = bsub_exit_ok;
+ goto bail_out;
default:
Mmsg2(jcr->errmsg, _("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",
jcr->last_fname, fd, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
}
}
-cleanup:
+bail_out:
if (acl_text) {
free(acl_text);
}
if ((filefd = open(name, O_RDONLY | O_NONBLOCK)) < 0) {
switch (errno) {
case ENOENT:
- goto cleanup;
+ retval = bsub_exit_ok;
+ goto bail_out;
default:
Mmsg2(jcr->errmsg, _("Unable to open file \"%s\": ERR=%s\n"),
jcr->last_fname, be.bstrerror());
Dmsg2(100, "Unable to open file \"%s\": ERR=%s\n",
jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
}
* But as this is not an error we return a positive return value.
*/
retval = bsub_exit_ok;
- goto cleanup;
+ goto bail_out;
case ENOENT:
- goto cleanup;
+ retval = bsub_exit_ok;
+ goto bail_out;
default:
Mmsg3(jcr->errmsg, _("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",
name, jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
}
jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to fchdir to xattr space on file \"%s\" using fd %d: ERR=%s\n",
jcr->last_fname, attrdirfd, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
/*
Dmsg3(100, "Unable to fdopendir xattr space on file \"%s\" using fd %d: ERR=%s\n",
jcr->last_fname, fd, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
/*
closedir(dirp);
retval = bsub_exit_ok;
-cleanup:
+bail_out:
if (attrdirfd != -1)
close(attrdirfd);
if (filefd != -1)
jcr->last_fname, be.bstrerror());
Dmsg2(100, "Unable to open file \"%s\": ERR=%s\n",
jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
/*
jcr->last_fname, be.bstrerror());
Dmsg2(100, "Unable to open xattr space on file \"%s\": ERR=%s\n",
jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
if (fchdir(attrdirfd) < 0) {
jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to fchdir to xattr space on file \"%s\" using fd %d: ERR=%s\n",
jcr->last_fname, attrdirfd, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
/*
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to open xattr %s on file \"%s\": ERR=%s\n",
target_attrname, jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
close(filefd);
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to open xattr space %s on file \"%s\": ERR=%s\n",
target_attrname, jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
close(attrdirfd);
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",
target_attrname, jcr->last_fname, attrdirfd, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
target_attrname = ++bp;
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to mkfifo xattr %s on file \"%s\": ERR=%s\n",
target_attrname, jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
break;
case S_IFCHR:
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to mknod xattr %s on file \"%s\": ERR=%s\n",
target_attrname, jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
break;
case S_IFDIR:
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to mkdir xattr %s on file \"%s\": ERR=%s\n",
target_attrname, jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
}
break;
target_attrname, linked_target, jcr->last_fname, be.bstrerror());
Dmsg4(100, "Unable to link xattr %s to %s on file \"%s\": ERR=%s\n",
target_attrname, linked_target, jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
/*
* Successfully restored xattr.
*/
retval = bsub_exit_ok;
- goto cleanup;
+ goto bail_out;
} else {
if ((bp = strchr(acl_text, '\0')) == (char *)NULL ||
(used_bytes = (bp - jcr->xattr_data)) >= total_bytes) {
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to open xattr %s on file \"%s\": ERR=%s\n",
target_attrname, jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
}
target_attrname, jcr->last_fname);
Dmsg2(100, "Unable to restore data of xattr %s on file \"%s\": Not all data available in xattr stream\n",
target_attrname, jcr->last_fname);
- goto cleanup;
+ goto bail_out;
}
while (cnt > 0) {
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to restore data of xattr %s on file \"%s\": ERR=%s\n",
target_attrname, jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
used_bytes += cnt;
target_attrname, linked_target, jcr->last_fname, be.bstrerror());
Dmsg4(100, "Unable to symlink xattr %s to %s on file \"%s\": ERR=%s\n",
target_attrname, linked_target, jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
/*
* Successfully restored xattr.
*/
retval = bsub_exit_ok;
- goto cleanup;
+ goto bail_out;
default:
- goto cleanup;
+ goto bail_out;
}
/*
Dmsg3(100, "Unable to restore owner of xattr %s on file \"%s\": ERR=%s\n",
target_attrname, jcr->last_fname, be.bstrerror());
}
- goto cleanup;
+ goto bail_out;
}
}
#ifdef HAVE_ACL
if (acl_text && *acl_text)
if (solaris_restore_xattr_acl(jcr, attrfd, target_attrname, acl_text) != bsub_exit_ok)
- goto cleanup;
+ goto bail_out;
#endif /* HAVE_ACL */
/*
target_attrname, jcr->last_fname, be.bstrerror());
Dmsg3(100, "Unable to restore filetimes of xattr %s on file \"%s\": ERR=%s\n",
target_attrname, jcr->last_fname, be.bstrerror());
- goto cleanup;
+ goto bail_out;
}
}
* Successfully restored xattr.
*/
retval = bsub_exit_ok;
- goto cleanup;
+ goto bail_out;
parse_error:
Mmsg1(jcr->errmsg, _("Illegal xattr stream, failed to parse xattr stream on file \"%s\"\n"),
Dmsg1(100, "Illegal xattr stream, failed to parse xattr stream on file \"%s\"\n",
jcr->last_fname);
-cleanup:
+bail_out:
if (attrfd != -1) {
close(attrfd);
}