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

Re: daemon.c broken on OpenBSD

From
Linus Torvalds <torvalds@osdl.org>
Date
Oct 24, 2005, 16:43 UTC
Message-ID
<Pine.LNX.4.64.0510240936450.10477@g5.osdl.org>
In-Reply-To
<86irvmzyq9.fsf@blue.stonehenge.com>
On Mon, 24 Oct 2005, Randal L. Schwartz wrote:
> 
> That probably won't work, because on OpenBSD, it's not a #define, but
> rather a real function call.  You can't just #undef that (unless my C
> is even more rusty).
Sure you can. 

The #undef won't necessarily _do_ anything, but it protects against systems where it is a #define. Then, the #define makes sure that if it's anything else, the #define will take precedence.

So yes, it's ugly, but it definitely is safe in practice, as long as the local headers are included before the system ones.

I think Junio's patch (that renames things) is possibly the "cleaner" alternative, but on the other hand there's a lot of advantages to just using the standard names. No chance of somebody using the wrong version by mistake.

			Linus
Previous: Randal L. SchwartzNext: H. Peter Anvin
Message 9 of 16 in “daemon.c broken on OpenBSD”
  1. Randal L. SchwartzOct 24, 2005
  2. Junio C HamanoOct 24, 2005
  3. Matthias UrlichsOct 24, 2005
  4. Randal L. SchwartzOct 25, 2005
  5. Randal L. SchwartzOct 25, 2005
  6. Randal L. SchwartzOct 25, 2005
  7. Linus TorvaldsOct 24, 2005
  8. Randal L. SchwartzOct 24, 2005
  9. Linus TorvaldsOct 24, 2005
  10. H. Peter AnvinOct 24, 2005
  11. Linus TorvaldsOct 24, 2005
  12. H. Peter AnvinOct 24, 2005
  13. Linus TorvaldsOct 24, 2005
  14. H. Peter AnvinOct 24, 2005
  15. Morten WelinderOct 24, 2005
  16. Junio C HamanoOct 24, 2005

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.