Allow nfs_lookuppath_async to have path[0]=='\0' this happens when we

want to create an object straight under the root directory of what we
mounted.
As always, the actual object to create is then a string starting after the \0 byte
libnfs-4.0.0-vitalif
Ronnie Sahlberg 2013-04-15 20:42:44 -07:00
parent c40efafc33
commit 73f4ae7cca
1 changed files with 3 additions and 4 deletions

View File

@ -660,8 +660,8 @@ static int nfs_lookuppath_async(struct nfs_context *nfs, const char *path, nfs_c
{
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;
}
@ -1731,7 +1731,6 @@ static int nfs_creat_continue_internal(struct nfs_context *nfs, struct nfs_cb_da
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;
@ -1767,7 +1766,7 @@ int nfs_creat_async(struct nfs_context *nfs, const char *path, int mode, nfs_cb
}
*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;