From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6462 invoked by alias); 6 Feb 2006 19:08:49 -0000 Received: (qmail 6452 invoked by uid 22791); 6 Feb 2006 19:08:48 -0000 X-Spam-Check-By: sourceware.org Received: from gandalf.inter.net.il (HELO gandalf.inter.net.il) (192.114.186.17) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 06 Feb 2006 19:08:47 +0000 Received: from nitzan.inter.net.il (nitzan.inter.net.il [192.114.186.20]) by gandalf.inter.net.il (MOS 3.7.1-GA) with ESMTP id HUJ00245; Mon, 6 Feb 2006 21:08:39 +0200 (IST) Received: from HOME-C4E4A596F7 (IGLD-84-228-241-54.inter.net.il [84.228.241.54]) by nitzan.inter.net.il (MOS 3.7.3-GA) with ESMTP id CQG92734 (AUTH halo1); Mon, 6 Feb 2006 21:07:25 +0200 (IST) Date: Mon, 06 Feb 2006 19:08:00 -0000 Message-Id: From: Eli Zaretskii To: gdb-patches@sourceware.org In-reply-to: <20060206173550.GB22947@nevyn.them.org> (message from Daniel Jacobowitz on Mon, 6 Feb 2006 12:35:50 -0500) Subject: Re: RFA: Support Windows extended error numbers in safe_strerror Reply-to: Eli Zaretskii References: <20060203215455.GA3501@nevyn.them.org> <20060206173550.GB22947@nevyn.them.org> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-02/txt/msg00131.txt.bz2 > Date: Mon, 6 Feb 2006 12:35:50 -0500 > From: Daniel Jacobowitz > > 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 > + > +/* 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.