git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] run-command: prettify -D_FORTIFY_SOURCE workaround

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Mar 16, 2011, 09:17 UTC
Message-ID
<4D80801A.1000208@viscovery.net>
In-Reply-To
<7v7hbzaan9.fsf@alter.siamese.dyndns.org>
Am 3/16/2011 6:37, schrieb Junio C Hamano:
Show 11 quoted lines
> It certainly is _not_ "ok" to see errors from write(2); we are _ignoring_
> the error because at that point in the codepath there isn't any better
> alternative.  The unusual "if ()" whose condition is solely for its side
> effect, with an empty body, is a strong enough sign to any reader that
> there is something fishy going on, and it would be helpful to the reader
> to hint _why_ such an unusual construct is there.  It would be much better
> for the longer term maintainability to say at least "gcc" in the comment,
> i.e.
> 
> 	if (write(...))
>         	; /* we know we are ignoring the error, mr gcc! */
And what about compilers that warn:
	';' : empty controlled statement found; is this the intent?
That's from MSVC. Perhaps:
	if (write(...))
		(void)0; /* we know we are ignoring the error, mr gcc! */
-- Hannes
Previous: Junio C HamanoNext: Jonathan Nieder
Message 7 of 8 in “run-command.c: fix build warnings on Ubuntu”
  1. run-command.c: fix build warnings on UbuntuMichael Wookey, Jan 29, 2010
  2. Markus HeidelbergJan 30, 2010
  3. run-command: prettify -D_FORTIFY_SOURCE workaroundJonathan Nieder, Mar 16, 2011
  4. Junio C HamanoMar 16, 2011
  5. run-command: prettify -D_FORTIFY_SOURCE workaroundJonathan Nieder, Mar 16, 2011
  6. Junio C HamanoMar 17, 2011
  7. Johannes SixtMar 16, 2011
  8. Jonathan NiederMar 16, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.