diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2014-01-28 12:49:39 +0000 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2014-01-28 12:49:39 +0000 |
commit | 738e76f0799fa598eac308144174c6cf9db21b7a (patch) | |
tree | 0cb787d50ff0753b81cd3b0913476c27adbe4686 /api | |
parent | 007182f1aad9d14e8d5bc7771d500b35026f0afa (diff) | |
parent | 6dfe01d7e726675913e98dc65c6c7406e5060e15 (diff) |
Merge branch 'upstream'
Diffstat (limited to 'api')
-rw-r--r-- | api/src/glfs-fops.c | 16 | ||||
-rw-r--r-- | api/src/glfs.c | 13 |
2 files changed, 12 insertions, 17 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index aa359a992..05f0997a8 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -2682,23 +2682,23 @@ glfs_fgetxattr (struct glfs_fd *glfd, const char *name, void *value, int glfs_listxattr_process (void *value, size_t size, dict_t *xattr) { - int ret = -1; - - ret = dict_keys_join (NULL, 0, xattr, NULL); + int ret = -1; - if (!value || !size) + if (!value || !size || !xattr) goto out; + ret = dict_keys_join (NULL, 0, xattr, NULL); + if (size < ret) { ret = -1; errno = ERANGE; - goto out; + } else { + dict_keys_join (value, size, xattr, NULL); } - dict_keys_join (value, size, xattr, NULL); + dict_unref (xattr); + out: - if (xattr) - dict_unref (xattr); return ret; } diff --git a/api/src/glfs.c b/api/src/glfs.c index 1bae78d23..174076e39 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -68,6 +68,10 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx) xlator_mem_acct_init (THIS, glfs_mt_end + 1); + if (!ctx) { + goto err; + } + ctx->process_uuid = generate_glusterfs_ctx_id (); if (!ctx->process_uuid) { goto err; @@ -210,20 +214,11 @@ err: static FILE * get_volfp (struct glfs *fs) { - int ret = 0; cmd_args_t *cmd_args = NULL; FILE *specfp = NULL; - struct stat statbuf; cmd_args = &fs->ctx->cmd_args; - ret = lstat (cmd_args->volfile, &statbuf); - if (ret == -1) { - gf_log ("glfs", GF_LOG_ERROR, - "%s: %s", cmd_args->volfile, strerror (errno)); - return NULL; - } - if ((specfp = fopen (cmd_args->volfile, "r")) == NULL) { gf_log ("glfs", GF_LOG_ERROR, "volume file %s: %s", |