From 0c1a9d7a6b0dd2ff09868a99141ed1fc98533d22 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 15 Apr 2013 21:37:03 -0700 Subject: [PATCH] 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 --- lib/libnfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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); -- 2.34.1