This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [gdbserver] Make mingw32ce gdbserver build again
- From: Daniel Jacobowitz <drow at false dot org>
- To: Pedro Alves <pedro_alves at portugalmail dot pt>
- Cc: GDB Patches <gdb-patches at sourceware dot org>
- Date: Thu, 31 Jan 2008 09:55:13 -0500
- Subject: Re: [gdbserver] Make mingw32ce gdbserver build again
- References: <47A138D6.5090108@portugalmail.pt>
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