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: [gdbserver] Make mingw32ce gdbserver build again


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


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