[RFA-v2] Avoid invalid parameter warnings in C runtime function for mingw built GDB

Pedro Alves palves@redhat.com
Wed Aug 14 12:01:00 GMT 2013


On 08/14/2013 12:38 PM, Pierre Muller wrote:

> Is this OK to commit?
> Maybe some comments on the ChangeLog entry?

> 	* common/filestuff.c (gdb_fopen_cloexec): Do not try to use "e"
> 	mode if operating system doesn't know O_CLOEXEC, this allows to
> 	avoid getting a output debug string warning for mingw hosted
> 	GDB executables.

This comment should really be in the sources instead.  That here you'd
have:

	* common/filestuff.c (gdb_fopen_cloexec): Do not try to use "e"
	mode if operating system doesn't know O_CLOEXEC.

and in the source, where you have:

> +  /* If O_CLOEXEC is zero, the operating system doesn't
> +     know about close on exec mode "e", so don't even try to use it.  */
> +  static int fopen_e_ever_failed = O_CLOEXEC == 0;

I suggest:

  /* Probe for "e" support once.  But, if we can tell the operating
     system doesn't know about close on exec mode "e" without probing,
     skip it.  E.g., the Windows runtime issues an "Invalid parameter
     passed to C runtime function" OutputDebugString warning for
     unknown modes.  Assume that if O_CLOEXEC is zero, then "e" isn't
     supported.  */
  static int fopen_e_ever_failed;

-- 
Pedro Alves



More information about the Gdb-patches mailing list