From f3d946646975cc04c5abd6b41adaf547175d6aab Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 30 Aug 2004 05:33:49 +0000 Subject: r2102: fixed a race condition when handling dos errors that are in our table. Should get rid of the static buffer completely at some point. (This used to be commit e0bda611121ed1f4afc2bfe83853e5521c494164) --- source4/libcli/util/doserr.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'source4') diff --git a/source4/libcli/util/doserr.c b/source4/libcli/util/doserr.c index c4ec869961..b8605864fc 100644 --- a/source4/libcli/util/doserr.c +++ b/source4/libcli/util/doserr.c @@ -22,13 +22,12 @@ #include "includes.h" -typedef const struct -{ +struct werror_code_struct { const char *dos_errstr; WERROR werror; -} werror_code_struct; +}; -werror_code_struct dos_errs[] = +static const struct werror_code_struct dos_errs[] = { { "WERR_OK", WERR_OK }, { "WERR_BADFILE", WERR_BADFILE }, @@ -79,8 +78,6 @@ const char *win_errstr(WERROR werror) static pstring msg; int idx = 0; - slprintf(msg, sizeof(msg), "DOS code 0x%08x", W_ERROR_V(werror)); - while (dos_errs[idx].dos_errstr != NULL) { if (W_ERROR_V(dos_errs[idx].werror) == W_ERROR_V(werror)) @@ -88,5 +85,7 @@ const char *win_errstr(WERROR werror) idx++; } + slprintf(msg, sizeof(msg), "DOS code 0x%08x", W_ERROR_V(werror)); + return msg; } -- cgit