From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19291 invoked by alias); 31 Jan 2008 14:55:37 -0000 Received: (qmail 19282 invoked by uid 22791); 31 Jan 2008 14:55:36 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 31 Jan 2008 14:55:17 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 3799898217; Thu, 31 Jan 2008 14:55:15 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 16FCF98214; Thu, 31 Jan 2008 14:55:15 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.68) (envelope-from ) id 1JKaor-00007H-9t; Thu, 31 Jan 2008 09:55:13 -0500 Date: Thu, 31 Jan 2008 15:02:00 -0000 From: Daniel Jacobowitz To: Pedro Alves Cc: GDB Patches Subject: Re: [gdbserver] Make mingw32ce gdbserver build again Message-ID: <20080131145513.GA32620@caradoc.them.org> Mail-Followup-To: Pedro Alves , GDB Patches References: <47A138D6.5090108@portugalmail.pt> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47A138D6.5090108@portugalmail.pt> User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-01/txt/msg00851.txt.bz2 On Thu, Jan 31, 2008 at 02:56:22AM +0000, Pedro Alves wrote: > static void > -hostio_error (char *own_buf, int error) > +hostio_error (char *own_buf) > { > - int fileio_error = errno_to_fileio_errno (error); > - > - sprintf (own_buf, "F-1,%x", fileio_error); > + sprintf (own_buf, "F-1,"); > + the_target->hostio_last_error (own_buf + 4); > } > Pretty much anything can change errno. That includes sprintf. So you have to save the value of errno before you call back into the C library, in general, or you might print some other error than the one you want. For now, how about the_target->hostio_last_error which converts to a protocol error and returns that? Then we can call it before sprintf. -- Daniel Jacobowitz CodeSourcery