summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/libcli/util/nterr.c13
-rw-r--r--source4/ntvfs/nbench/vfs_nbench.c39
2 files changed, 26 insertions, 26 deletions
diff --git a/source4/libcli/util/nterr.c b/source4/libcli/util/nterr.c
index 99b5191273..f2b15f03e8 100644
--- a/source4/libcli/util/nterr.c
+++ b/source4/libcli/util/nterr.c
@@ -897,22 +897,23 @@ const char *get_friendly_nt_error_msg(NTSTATUS nt_code)
Returns an NT_STATUS constant as a string for inclusion in autogen C code.
*****************************************************************************/
-const char *get_nt_error_c_code(NTSTATUS nt_code)
+const char *get_nt_error_c_code(TALLOC_CTX *mem_ctx, NTSTATUS nt_code)
{
- static char out[40];
+ char *result;
int idx = 0;
while (nt_errs[idx].nt_errstr != NULL) {
if (NT_STATUS_V(nt_errs[idx].nt_errcode) ==
NT_STATUS_V(nt_code)) {
- return nt_errs[idx].nt_errstr;
+ result = talloc_strdup(mem_ctx, nt_errs[idx].nt_errstr);
+ return result;
}
idx++;
}
- slprintf(out, sizeof(out), "NT_STATUS(0x%08x)", NT_STATUS_V(nt_code));
-
- return out;
+ result = talloc_asprintf(mem_ctx, "NT_STATUS(0x%08x)",
+ NT_STATUS_V(nt_code));
+ return result;
}
/*****************************************************************************
diff --git a/source4/ntvfs/nbench/vfs_nbench.c b/source4/ntvfs/nbench/vfs_nbench.c
index 35cd86f34d..565f2dafed 100644
--- a/source4/ntvfs/nbench/vfs_nbench.c
+++ b/source4/ntvfs/nbench/vfs_nbench.c
@@ -165,10 +165,9 @@ static NTSTATUS nbench_disconnect(struct ntvfs_module_context *ntvfs)
static void nbench_unlink_send(struct ntvfs_request *req)
{
union smb_unlink *unl = req->async_states->private_data;
-
nbench_log(req, "Unlink \"%s\" 0x%x %s\n",
unl->unlink.in.pattern, unl->unlink.in.attrib,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
PASS_THRU_REP_POST(req);
}
@@ -213,7 +212,7 @@ static void nbench_chkpath_send(struct ntvfs_request *req)
nbench_log(req, "Chkpath \"%s\" %s\n",
cp->chkpath.in.path,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
PASS_THRU_REP_POST(req);
}
@@ -239,7 +238,7 @@ static void nbench_qpathinfo_send(struct ntvfs_request *req)
nbench_log(req, "QUERY_PATH_INFORMATION \"%s\" %d %s\n",
info->generic.in.file.path,
info->generic.level,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
PASS_THRU_REP_POST(req);
}
@@ -264,7 +263,7 @@ static void nbench_qfileinfo_send(struct ntvfs_request *req)
nbench_log(req, "QUERY_FILE_INFORMATION %s %d %s\n",
nbench_ntvfs_handle_string(req, info->generic.in.file.ntvfs),
info->generic.level,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
PASS_THRU_REP_POST(req);
}
@@ -289,7 +288,7 @@ static void nbench_setpathinfo_send(struct ntvfs_request *req)
nbench_log(req, "SET_PATH_INFORMATION \"%s\" %d %s\n",
st->generic.in.file.path,
st->generic.level,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
PASS_THRU_REP_POST(req);
}
@@ -321,7 +320,7 @@ static void nbench_open_send(struct ntvfs_request *req)
io->ntcreatex.in.create_options,
io->ntcreatex.in.open_disposition,
nbench_ntvfs_handle_string(req, io->ntcreatex.out.file.ntvfs),
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
break;
default:
@@ -373,7 +372,7 @@ static void nbench_rmdir_send(struct ntvfs_request *req)
nbench_log(req, "Rmdir \"%s\" %s\n",
rd->in.path,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
PASS_THRU_REP_POST(req);
}
@@ -400,7 +399,7 @@ static void nbench_rename_send(struct ntvfs_request *req)
nbench_log(req, "Rename \"%s\" \"%s\" %s\n",
ren->rename.in.pattern1,
ren->rename.in.pattern2,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
break;
default:
@@ -459,7 +458,7 @@ static void nbench_read_send(struct ntvfs_request *req)
(int)rd->readx.in.offset,
rd->readx.in.maxcnt,
rd->readx.out.nread,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
break;
default:
nbench_log(req, "Read-%d - NOT HANDLED\n",
@@ -497,7 +496,7 @@ static void nbench_write_send(struct ntvfs_request *req)
(int)wr->writex.in.offset,
wr->writex.in.count,
wr->writex.out.nwritten,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
break;
case RAW_WRITE_WRITE:
@@ -509,7 +508,7 @@ static void nbench_write_send(struct ntvfs_request *req)
wr->write.in.offset,
wr->write.in.count,
wr->write.out.nwritten,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
break;
default:
@@ -563,12 +562,12 @@ static void nbench_flush_send(struct ntvfs_request *req)
case RAW_FLUSH_FLUSH:
nbench_log(req, "Flush %s %s\n",
nbench_ntvfs_handle_string(req, io->flush.in.file.ntvfs),
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
break;
case RAW_FLUSH_ALL:
nbench_log(req, "Flush %d %s\n",
0xFFFF,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
break;
default:
nbench_log(req, "Flush-%d - NOT HANDLED\n",
@@ -601,7 +600,7 @@ static void nbench_close_send(struct ntvfs_request *req)
case RAW_CLOSE_CLOSE:
nbench_log(req, "Close %s %s\n",
nbench_ntvfs_handle_string(req, io->close.in.file.ntvfs),
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
break;
default:
@@ -718,14 +717,14 @@ static void nbench_lock_send(struct ntvfs_request *req)
nbench_ntvfs_handle_string(req, lck->lockx.in.file.ntvfs),
(int)lck->lockx.in.locks[0].offset,
(int)lck->lockx.in.locks[0].count,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
} else if (lck->generic.level == RAW_LOCK_LOCKX &&
lck->lockx.in.ulock_cnt == 1) {
nbench_log(req, "UnlockX %s %d %d %s\n",
nbench_ntvfs_handle_string(req, lck->lockx.in.file.ntvfs),
(int)lck->lockx.in.locks[0].offset,
(int)lck->lockx.in.locks[0].count,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
} else {
nbench_log(req, "Lock-%d - NOT HANDLED\n", lck->generic.level);
}
@@ -753,7 +752,7 @@ static void nbench_setfileinfo_send(struct ntvfs_request *req)
nbench_log(req, "SET_FILE_INFORMATION %s %d %s\n",
nbench_ntvfs_handle_string(req, info->generic.in.file.ntvfs),
info->generic.level,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
PASS_THRU_REP_POST(req);
}
@@ -778,7 +777,7 @@ static void nbench_fsinfo_send(struct ntvfs_request *req)
nbench_log(req, "QUERY_FS_INFORMATION %d %s\n",
fs->generic.level,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
PASS_THRU_REP_POST(req);
}
@@ -832,7 +831,7 @@ static void nbench_search_first_send(struct ntvfs_request *req)
io->t2ffirst.data_level,
io->t2ffirst.in.max_count,
io->t2ffirst.out.count,
- get_nt_error_c_code(req->async_states->status));
+ get_nt_error_c_code(req, req->async_states->status));
break;
default: