From: Ronnie Sahlberg Date: Tue, 16 Apr 2013 04:37:03 +0000 (-0700) Subject: Fix a bug when returning the filehandle in creat() and return the filehandle X-Git-Tag: upstream/1.9.6^2~210 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=0c1a9d7a6b0dd2ff09868a99141ed1fc98533d22;p=deb_libnfs.git Fix a bug when returning the filehandle in creat() and return the filehandle of the object we created and not the filehandle of the parent directory --- diff --git a/lib/libnfs.c b/lib/libnfs.c index 93cd629..d2f60da 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -1675,10 +1675,10 @@ static void nfs_create_2_cb(struct rpc_context *rpc, int status, void *command_d } memset(nfsfh, 0, sizeof(struct nfsfh)); - /* steal the filehandle */ - nfsfh->fh.data.data_len = data->fh.data.data_len; - nfsfh->fh.data.data_val = data->fh.data.data_val; - data->fh.data.data_val = NULL; + /* copy the filehandle */ + nfsfh->fh.data.data_len = res->LOOKUP3res_u.resok.object.data.data_len; + nfsfh->fh.data.data_val = malloc(nfsfh->fh.data.data_len); + memcpy(nfsfh->fh.data.data_val, res->LOOKUP3res_u.resok.object.data.data_val, nfsfh->fh.data.data_len); data->cb(0, nfs, nfsfh, data->private_data); free_nfs_cb_data(data);