{
struct nfs_cb_data *data = private_data;
struct nfs_context *nfs = data->nfs;
+ struct nfsfh *nfsfh;
SETATTR3res *res;
assert(rpc->magic == RPC_CONTEXT_MAGIC);
return;
}
- data->cb(0, nfs, NULL, data->private_data);
+ nfsfh = malloc(sizeof(struct nfsfh));
+ if (nfsfh == NULL) {
+ rpc_set_error(nfs->rpc, "NFS: Failed to allocate nfsfh structure");
+ data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
+ free_nfs_cb_data(data);
+ return;
+ }
+ memset(nfsfh, 0, sizeof(struct nfsfh));
+
+ if (data->continue_int & O_SYNC) {
+ nfsfh->is_sync = 1;
+ }
+
+ /* steal the filehandle */
+ nfsfh->fh = data->fh;
+ data->fh.data.data_val = NULL;
+
+ data->cb(0, nfs, nfsfh, data->private_data);
free_nfs_cb_data(data);
}
return;
}
- nfsfh = malloc(sizeof(struct nfsfh));
- if (nfsfh == NULL) {
- rpc_set_error(nfs->rpc, "NFS: Failed to allocate nfsfh structure");
- data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
- free_nfs_cb_data(data);
- return;
- }
- memset(nfsfh, 0, sizeof(struct nfsfh));
-
- if (data->continue_int & O_SYNC) {
- nfsfh->is_sync = 1;
- }
-
- /* steal the filehandle */
- nfsfh->fh = data->fh;
- data->fh.data.data_val = NULL;
-
/* Try to truncate it if we were requested to */
if ((data->continue_int & O_TRUNC) &&
(data->continue_int & (O_RDWR|O_WRONLY))) {
SETATTR3args args;
memset(&args, 0, sizeof(SETATTR3args));
- args.object = nfsfh->fh;
+ args.object = data->fh;
args.new_attributes.size.set_it = 1;
args.new_attributes.size.set_size3_u.size = 0;
return;
}
+ nfsfh = malloc(sizeof(struct nfsfh));
+ if (nfsfh == NULL) {
+ rpc_set_error(nfs->rpc, "NFS: Failed to allocate nfsfh structure");
+ data->cb(-ENOMEM, nfs, rpc_get_error(nfs->rpc), data->private_data);
+ free_nfs_cb_data(data);
+ return;
+ }
+ memset(nfsfh, 0, sizeof(struct nfsfh));
+
+ if (data->continue_int & O_SYNC) {
+ nfsfh->is_sync = 1;
+ }
+
+ /* steal the filehandle */
+ nfsfh->fh = data->fh;
+ data->fh.data.data_val = NULL;
+
data->cb(0, nfs, nfsfh, data->private_data);
free_nfs_cb_data(data);
}