diff options
author | Sheetal Pamecha <spamecha@redhat.com> | 2019-08-19 15:27:57 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@gmail.com> | 2019-09-12 08:02:34 +0000 |
commit | 61d438e73857776a1f96a7334f56b132275a587b (patch) | |
tree | 17f3fa5bb186097fd67dc21c2c1ba2e23e25dbab /libglusterfs/src/graph.c | |
parent | da76f7bbef4d311775a5f75c96a54785170a1727 (diff) |
libgfapi: return correct errno on invalid volume name
glfs_init when called with volume name prefixed by '/'
sets errno to 0. Setting errno to EINVAL to resolve the issue.
Also volname is a parameter to glfs_new.
Thus, validating volname in glfs_new itself and
returning EINVAL from that function
fixes: bz#1507896
Change-Id: I0d4d2423e26cc07644d50ec8cce788ecc639203d
Signed-off-by: Sheetal Pamecha <spamecha@redhat.com>
Diffstat (limited to 'libglusterfs/src/graph.c')
-rw-r--r-- | libglusterfs/src/graph.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c index e6ae40db2ed..913f57804cc 100644 --- a/libglusterfs/src/graph.c +++ b/libglusterfs/src/graph.c @@ -568,14 +568,13 @@ glusterfs_graph_prepare(glusterfs_graph_t *graph, glusterfs_ctx_t *ctx, } else { ret = glusterfs_graph_settop(graph, volume_name, _gf_false); } - if (!ret) { - goto ok; - } - gf_msg("graph", GF_LOG_ERROR, 0, LG_MSG_GRAPH_ERROR, - "glusterfs graph settop failed"); - return -1; -ok: + if (ret) { + gf_msg("graph", GF_LOG_ERROR, EINVAL, LG_MSG_GRAPH_ERROR, + "glusterfs graph settop failed"); + errno = EINVAL; + return -1; + } /* XXX: WORM VOLUME */ ret = glusterfs_graph_worm(graph, ctx); |