From: Ronnie Sahlberg Date: Tue, 16 Apr 2013 03:42:44 +0000 (-0700) Subject: Allow nfs_lookuppath_async to have path[0]=='\0' this happens when we X-Git-Tag: upstream/1.9.6^2~211 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=73f4ae7cca447767dbcf4e574e585be007d3be47;p=deb_libnfs.git 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 --- diff --git a/lib/libnfs.c b/lib/libnfs.c index c07a8e8..93cd629 100644 --- a/lib/libnfs.c +++ b/lib/libnfs.c @@ -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;