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/clierror.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/clierror.c')
-rw-r--r-- | source3/libsmb/clierror.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source3/libsmb/clierror.c b/source3/libsmb/clierror.c index 1c35bcf146..2232ee27a7 100644 --- a/source3/libsmb/clierror.c +++ b/source3/libsmb/clierror.c @@ -98,14 +98,15 @@ static NTSTATUS cli_smb_rw_error_to_ntstatus(struct cli_state *cli) const char *cli_errstr(struct cli_state *cli) { - static fstring cli_error_message; + fstring cli_error_message; uint32 flgs2 = SVAL(cli->inbuf,smb_flg2), errnum; uint8 errclass; int i; + char *result; if (!cli->initialised) { fstrcpy(cli_error_message, "[Programmer's error] cli_errstr called on unitialized cli_stat struct!\n"); - return cli_error_message; + goto done; } /* Was it server socket error ? */ @@ -137,7 +138,7 @@ const char *cli_errstr(struct cli_state *cli) "Unknown error code %d\n", cli->smb_rw_error ); break; } - return cli_error_message; + goto done; } /* Case #1: RAP error */ @@ -151,7 +152,7 @@ const char *cli_errstr(struct cli_state *cli) slprintf(cli_error_message, sizeof(cli_error_message) - 1, "RAP code %d", cli->rap_error); - return cli_error_message; + goto done; } /* Case #2: 32-bit NT errors */ @@ -166,6 +167,11 @@ const char *cli_errstr(struct cli_state *cli) /* Case #3: SMB error */ return cli_smb_errstr(cli); + + done: + result = talloc_strdup(talloc_tos(), cli_error_message); + SMB_ASSERT(result); + return result; } |