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

Re: [PATCH] add strerror(errno) to die() calls where applicable

From
Jeff King <peff@peff.net>
Date
Jun 4, 2009, 20:32 UTC
Message-ID
<20090604203239.GA17478@sigill.intra.peff.net>
In-Reply-To
<2325a7950906031858oed495d0x406ea375ff08eb28@mail.gmail.com>
On Thu, Jun 04, 2009 at 05:58:14AM +0400, Alexander Potashev wrote:
Show 8 quoted lines
> I was also thinking (about 1 month ago) about a helper function
> similar to your 'diesys', but I never thought that adding yet another
> "backend" function (diesys_routine) is reasonable.
> 
> Following your approach, you will need to add 'set_diesys_routine' and
> call it along with 'set_die_routine' (however, if you want to use
> 'diesys', but there are several places in 'daemon.c' and
> 'fast-import.c' where 'die' is being used to write 'strerror(errno)').

Yeah, I didn't look into who is actually using set_die_routine, but adding another routine like this makes it a lot more annoying for git-daemon to use it. So I think your approach is probably better, though I have a few comments on the patch itself (which I'll put in the next mail).

-Peff

PS Actually, the nicest interface IMHO would be a variadic macro like:

  #define diesys(fmt, ...) die(fmt ": %s", __VA_ARGS__, strerror(errno))
but that requires a c99 compiler, which we otherwise do not need.
Previous: Alexander Potashev
Message 28 of 28 in “add strerror(errno) to die() calls where applicable”
  1. add strerror(errno) to die() calls where applicableThomas Rast, Jun 2, 2009
  2. Jeff KingJun 3, 2009
  3. diesys calls die and also reports strerror(errno)Alexander Potashev, Jun 4, 2009
  4. Jeff KingJun 4, 2009
  5. Junio C HamanoJun 4, 2009
  6. Johannes SixtJun 5, 2009
  7. Junio C HamanoJun 5, 2009
  8. Jeff KingJun 6, 2009
  9. Thomas RastJun 6, 2009
  10. 0/3 Thomas Rast <trast@student.ethz.ch>Thomas Rast, Jun 6, 2009
  11. 1/3 Introduce die_errno() that appends strerror(errno) to die()Thomas Rast, Jun 6, 2009
  12. 2/3 Convert existing die(..., strerror(errno)) to die_errno()Thomas Rast, Jun 6, 2009
  13. 3/3 Use die_errno() instead of die() when checking syscallsThomas Rast, Jun 6, 2009
  14. Johannes SixtJun 6, 2009
  15. Thomas RastJun 6, 2009
  16. Johannes SixtJun 6, 2009
  17. Johannes SixtJun 6, 2009
  18. Thomas RastJun 6, 2009
  19. Johannes SixtJun 6, 2009
  20. Jeff KingJun 6, 2009
  21. Jeff KingJun 6, 2009
  22. Alexander PotashevJun 7, 2009
  23. Junio C HamanoJun 7, 2009
  24. Jeff KingJun 8, 2009
  25. Alexander PotashevJun 8, 2009
  26. Jeff KingJun 8, 2009
  27. Alexander PotashevJun 4, 2009
  28. Jeff KingJun 4, 2009

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.