diff options
author | Volker Lendecke <Volker.Lendecke@SerNet.DE> | 2007-11-11 15:30:01 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-11-11 21:34:40 -0800 |
commit | 6069670f1bebc37527c8363a72a653e43fff7c0b (patch) | |
tree | 65e70d7b07a35fc977c35c2aaef49492cead627a /source3/libsmb/nterr.c | |
parent | 7e9d639ed1584c2f7cd3556ce3e93974851f74c6 (diff) | |
download | samba-6069670f1bebc37527c8363a72a653e43fff7c0b.tar.gz samba-6069670f1bebc37527c8363a72a653e43fff7c0b.tar.bz2 samba-6069670f1bebc37527c8363a72a653e43fff7c0b.zip |
Some pstring removal
Hi!
Feel free to push :-)
Volker
From 7fae6b3709a973bd0a5a13d3f5c880c61d5e35de Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl@sernet.de>
Date: Sun, 11 Nov 2007 15:28:59 +0100
Subject: [PATCH] Remove some static pstrings
(This used to be commit c3a66b4ee97a902c5cf43c3bb145541849a029ed)
Diffstat (limited to 'source3/libsmb/nterr.c')
-rw-r--r-- | source3/libsmb/nterr.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source3/libsmb/nterr.c b/source3/libsmb/nterr.c index d88e650c9c..cf443f2339 100644 --- a/source3/libsmb/nterr.c +++ b/source3/libsmb/nterr.c @@ -647,8 +647,8 @@ nt_err_code_struct nt_err_desc[] = const char *nt_errstr(NTSTATUS nt_code) { - static pstring msg; int idx = 0; + char *result; #ifdef HAVE_LDAP if (NT_STATUS_TYPE(nt_code) == NT_STATUS_TYPE_LDAP) { @@ -656,8 +656,6 @@ const char *nt_errstr(NTSTATUS nt_code) } #endif - slprintf(msg, sizeof(msg), "NT code 0x%08x", NT_STATUS_V(nt_code)); - while (nt_errs[idx].nt_errstr != NULL) { if (NT_STATUS_EQUAL(nt_errs[idx].nt_errcode, nt_code)) { return nt_errs[idx].nt_errstr; @@ -665,7 +663,10 @@ const char *nt_errstr(NTSTATUS nt_code) idx++; } - return msg; + result = talloc_asprintf(talloc_tos(), "NT code 0x%08x", + NT_STATUS_V(nt_code)); + SMB_ASSERT(result != NULL); + return result; } /************************************************************************ @@ -694,7 +695,7 @@ const char *get_friendly_nt_error_msg(NTSTATUS nt_code) const char *get_nt_error_c_code(NTSTATUS nt_code) { - static pstring out; + char *result; int idx = 0; while (nt_errs[idx].nt_errstr != NULL) { @@ -705,9 +706,10 @@ const char *get_nt_error_c_code(NTSTATUS nt_code) idx++; } - slprintf(out, sizeof(out), "NT_STATUS(0x%08x)", NT_STATUS_V(nt_code)); - - return out; + result = talloc_asprintf(talloc_tos(), "NT_STATUS(0x%08x)", + NT_STATUS_V(nt_code)); + SMB_ASSERT(result); + return result; } /***************************************************************************** |