From 47f03734685076fce51eaacb706796d2213bdbf1 Mon Sep 17 00:00:00 2001 From: Shehjar Tikoo Date: Tue, 7 Apr 2009 05:32:47 -0700 Subject: libglusterfsclient: Fix segfault in glusterfs_open libgf_client_loc_fill gets passed a name=NULL argument. So when this function returns the filled loc argument, this loc is actually missing the inode structure that was to be filled. The segfault actually occurs a few lines later when we try to access fd->flags but fd returned by fd_create is NULL because we'd passed a NULL inode to it, i.e. the loc->inode. Signed-off-by: Anand V. Avati --- libglusterfsclient/src/libglusterfsclient.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libglusterfsclient/src') diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 40273d5de5b..e02cbdc770b 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -1543,6 +1543,9 @@ glusterfs_open (glusterfs_handle_t handle, goto out; } + pathname = strdup (path); + name = basename (pathname); + ret = libgf_client_loc_fill (&loc, ctx, 0, loc.parent->ino, name); if (ret == -1) { gf_log ("libglusterfsclient", @@ -1552,9 +1555,6 @@ glusterfs_open (glusterfs_handle_t handle, goto out; } - pathname = strdup (path); - name = basename (pathname); - this = ctx->gf_ctx.graph; fd = fd_create (loc.inode, 0); fd->flags = flags; -- cgit