WIN32 fixes
[deb_libnfs.git] / lib / libnfs.c
index 93cd62902a081d9fb7d3679e0a3c10011d05bdae..97663ac658ff2fe4d2285b7833c2c5bb8c79482b 100644 (file)
@@ -30,6 +30,7 @@
 #else
 #include <strings.h>
 #include <utime.h>
+#include <netinet/in.h>
 #endif /*WIN32*/
 
 #ifdef ANDROID
@@ -59,7 +60,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <netinet/in.h>
 #include "libnfs-zdr.h"
 #include "libnfs.h"
 #include "libnfs-raw.h"
@@ -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);