summaryrefslogtreecommitdiff
path: root/source4/libcli
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-05-04 15:30:01 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-05-06 07:51:24 +0200
commit344eb08ee4e444c1fc1beac26e50c6a85b942885 (patch)
tree858b257029ba787fea480ce3e724c3f521bf9817 /source4/libcli
parentc83aed2568761adda5f4f09e044788557767347e (diff)
downloadsamba-344eb08ee4e444c1fc1beac26e50c6a85b942885.tar.gz
samba-344eb08ee4e444c1fc1beac26e50c6a85b942885.tar.bz2
samba-344eb08ee4e444c1fc1beac26e50c6a85b942885.zip
nterr: Add mem_ctx for return string from get_nt_error_c_code()
It is clearer to avoid the implicit return on talloc_tos() Andrew Bartlett
Diffstat (limited to 'source4/libcli')
-rw-r--r--source4/libcli/util/nterr.c13
1 files changed, 7 insertions, 6 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;
}
/*****************************************************************************