/*
* High level api to nfs filesystems
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef AROS
+#include "aros_compat.h"
+#endif
+
#ifdef WIN32
#include "win32_compat.h"
#else
-
#include <strings.h>
#include <utime.h>
-#include <unistd.h>
+#endif /*WIN32*/
-#ifdef AROS
-#include "aros_compat.h"
-#else
#ifdef ANDROID
-#include <sys/vfs.h>
#define statvfs statfs
-#else
-#include <sys/statvfs.h>
-#endif /*ANDROID*/
-#endif /*AROS*/
-#endif /*WIN32*/
+#endif
#define _GNU_SOURCE
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
{
struct nfs_cb_data *data;
- if (path[0] != '/') {
- rpc_set_error(nfs->rpc, "Pathname is not absulute %s", path);
+ if (path[0] != 0 && path[0] != '/') {
+ rpc_set_error(nfs->rpc, "Pathname is not absolute %s", path);
return -1;
}
}
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);
str = &str[strlen(str) + 1];
-
memset(&args, 0, sizeof(CREATE3args));
args.where.dir.data.data_len = data->fh.data.data_len;
args.where.dir.data.data_val = data->fh.data.data_val;
}
*ptr = 0;
- /* new_path now points to the parent directory, and beyond the nul terminateor is the new directory to create */
+ /* new_path now points to the parent directory, and beyond the nul terminator is the new directory to create */
if (nfs_lookuppath_async(nfs, new_path, cb, private_data, nfs_creat_continue_internal, new_path, free, mode) != 0) {
rpc_set_error(nfs->rpc, "Out of memory: failed to start parsing the path components");
return -1;