Skip to content

Commit

Permalink
Merge branch 'bareos-15.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco van Wieringen committed Sep 25, 2015
2 parents f25feb4 + f45afb5 commit 4f98ae7
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 22 deletions.
7 changes: 4 additions & 3 deletions src/findlib/bfile.c
Expand Up @@ -1173,16 +1173,17 @@ int bclose(BFILE *bfd)
{
int status;

if (bfd->fid == -1) {
return 0;
}

Dmsg1(400, "Close file %d\n", bfd->fid);

if (bfd->cmd_plugin && plugin_bclose) {
status = plugin_bclose(bfd);
bfd->fid = -1;
bfd->cmd_plugin = false;
} else {
if (bfd->fid == -1) {
return 0;
}
#if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
if (bfd->m_flags & O_RDONLY) {
fdatasync(bfd->fid); /* sync the file */
Expand Down
2 changes: 1 addition & 1 deletion src/findlib/xattr.c
Expand Up @@ -206,7 +206,7 @@ uint32_t serialize_xattr_stream(JCR *jcr,
ser_bytes(current_xattr->value, current_xattr->value_length);

Dmsg3(100, "Backup xattr named %s, value %*s\n",
current_xattr->name, current_xattr->value, current_xattr->value);
current_xattr->name, current_xattr->value_length, current_xattr->value);
} else {
Dmsg1(100, "Backup empty xattr named %s\n", current_xattr->name);
}
Expand Down
36 changes: 27 additions & 9 deletions src/plugins/filed/cephfs-fd.c
Expand Up @@ -1678,6 +1678,11 @@ static bRC getXattr(bpContext *ctx, xattr_pkt *xp)
Jmsg(ctx, M_ERROR, "ceph_llistxattr(%s) failed: %s\n", xp->fname, be.bstrerror(-status));
return bRC_Error;
}
} else if (status == 0) {
/*
* Nothing to do.
*/
return bRC_OK;
}

/*
Expand All @@ -1686,6 +1691,16 @@ static bRC getXattr(bpContext *ctx, xattr_pkt *xp)
break;
}

/*
* Data from llistxattr is in the following form:
*
* user.name1\0system.name1\0user.name2\0
*
* We add an extra \0 at the end so we have an unique terminator
* to know when we hit the end of the list.
*/
p_ctx->xattr_list = check_pool_memory_size(p_ctx->xattr_list, status + 1);
p_ctx->xattr_list[status] = '\0';
p_ctx->next_xattr_name = p_ctx->xattr_list;
p_ctx->processing_xattr = true;
}
Expand Down Expand Up @@ -1769,16 +1784,19 @@ static bRC getXattr(bpContext *ctx, xattr_pkt *xp)
* See if there are more xattr to process.
*/
bp = strchr(p_ctx->next_xattr_name, '\0');
if (++bp != '\0') {
p_ctx->next_xattr_name = bp;
return bRC_More;
} else {
/*
* No more reset processing_xattr flag.
*/
p_ctx->processing_xattr = false;
return bRC_OK;
if (bp) {
bp++;
if (*bp != '\0') {
p_ctx->next_xattr_name = bp;
return bRC_More;
}
}

/*
* No more reset processing_xattr flag.
*/
p_ctx->processing_xattr = false;
return bRC_OK;
}

static bRC setXattr(bpContext *ctx, xattr_pkt *xp)
Expand Down
36 changes: 27 additions & 9 deletions src/plugins/filed/gfapi-fd.c
Expand Up @@ -1908,6 +1908,11 @@ static bRC getXattr(bpContext *ctx, xattr_pkt *xp)
Jmsg(ctx, M_ERROR, "glfs_llistxattr(%s) failed: %s\n", xp->fname, be.bstrerror());
return bRC_Error;
}
} else if (status == 0) {
/*
* Nothing to do.
*/
return bRC_OK;
}

/*
Expand All @@ -1916,6 +1921,16 @@ static bRC getXattr(bpContext *ctx, xattr_pkt *xp)
break;
}

/*
* Data from llistxattr is in the following form:
*
* user.name1\0system.name1\0user.name2\0
*
* We add an extra \0 at the end so we have an unique terminator
* to know when we hit the end of the list.
*/
p_ctx->xattr_list = check_pool_memory_size(p_ctx->xattr_list, status + 1);
p_ctx->xattr_list[status] = '\0';
p_ctx->next_xattr_name = p_ctx->xattr_list;
p_ctx->processing_xattr = true;
}
Expand Down Expand Up @@ -2000,16 +2015,19 @@ static bRC getXattr(bpContext *ctx, xattr_pkt *xp)
* See if there are more xattr to process.
*/
bp = strchr(p_ctx->next_xattr_name, '\0');
if (++bp != '\0') {
p_ctx->next_xattr_name = bp;
return bRC_More;
} else {
/*
* No more reset processing_xattr flag.
*/
p_ctx->processing_xattr = false;
return bRC_OK;
if (bp) {
bp++;
if (*bp != '\0') {
p_ctx->next_xattr_name = bp;
return bRC_More;
}
}

/*
* No more reset processing_xattr flag.
*/
p_ctx->processing_xattr = false;
return bRC_OK;
}

static bRC setXattr(bpContext *ctx, xattr_pkt *xp)
Expand Down

0 comments on commit 4f98ae7

Please sign in to comment.