Re: RFA: Support Windows extended error numbers in safe_strerror

Eli Zaretskii
2006-02-04T11:58:45Z

> Date: Fri, 3 Feb 2006 16:54:55 -0500
> From: Daniel Jacobowitz <drow@false.org>
>
> This is an improved version of a patch Mark Mitchell submitted last
> year. If you give strerror() anything above 42 (sys_nerr) on Windows,
> it gives you back "Unknown error" - particularly unfortunate since
> WSAECONNREFUSED is way above there, so connecting to a closed socket
> will give you a generic error message. This patch lets us try an
> OS-specific interface to fetch an error string.
>
> [Actually you need my next patch too to get the connection refused message;
> right now you'll get a timeout.]
>
> Any comments on this patch?
>
> --
> Daniel Jacobowitz
> CodeSourcery
>
> 2006-02-03 Daniel Jacobowitz <dan@codesourcery.com>
>
> * utils.c (safe_strerror): Try to use FormatMessage for otherwise
> unknown messages on Windows.

How about if you put this in some function on win32-nat.c, and then
leave only the conditional call to that function in utils.c? Actualy,
perhaps we don't need any ifdef at all, since I think there's no way
the argument can be greater than sys_nerr on other platforms, right?

Otherwise, I'm okay with this patch.