This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: Support Windows extended error numbers in safe_strerror


> Date: Mon, 6 Feb 2006 12:35:50 -0500
> From: Daniel Jacobowitz <drow@false.org>
> 
> On Fri, Feb 03, 2006 at 04:54:55PM -0500, Daniel Jacobowitz wrote:
> > 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?
> 
> There were plenty :-)  Is this better?
> [...]
> +#include "defs.h"
> +#include "gdb_string.h"
> +
> +#include <windows.h>
> +
> +/* The Windows runtime implementation of strerror never returns NULL,
> +   but does return a useless string for anything above sys_nerr;
> +   unfortunately this includes all socket-related error codes.
> +   This replacement tries to find a system-provided error message.  */
> +
> +char *
> +mingw_strerror (int errnum)
> +{
> +  static char *buffer;
> +  int len;
> +
> +  if (errnum >= 0 && errnum < sys_nerr)
> +    return strerror (errnum);

Shouldn't you #undef strerror in this file?

Otherwise, this is fine with me.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]