Re: [PATCH v3 1/3] Introduce die_errno() that appends strerror(errno) to die()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 09, 2009 at 10:22:30AM +0200, Thomas Rast wrote:

> > Aren't you assuming that strerror(errno) has no '%'-signs here, which is
> > what kicked off the whole discussion?
> 
> True, of course.  Hrm.
> 
> So do we go back to v2 (for 1/3) and ask future callers to never use
> custom formats with die_errno, or should I write a version that
> doubles the % characters while tacking the error message onto the
> format?

Personally, I think it is fine to assume that the format and arguments
to die(), die_errno(), and to the die_routine() are all
printf-compatible. That is how it has always been until now, and I don't
see any callers who would want to change that.

This is all internal to git.  It's not as if we are talking about a
library being called by arbitrary code, and we want to leave doors open
for arbitrary clients. libgit2 would probably take a different approach
(though I imagine their general strategy is never to die(), but to
always return an error condition, anyway).

> [It's a pity that it seems impossible to add an extra argument to the
> va_args...]

Agreed, but I think we are out of luck short of variadic macros (which
are a C99-ism, and even then have some issues).

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]