[prev in list] [next in list] [prev in thread] [next in thread]
List: git
Subject: Re: [PATCH v3 1/3] Introduce die_errno() that appends strerror(errno) to die()
From: Thomas Rast <trast () student ! ethz ! ch>
Date: 2009-06-09 8:22:30
Message-ID: 200906091022.31738.trast () student ! ethz ! ch
[Download RAW message or body]
Jeff King wrote:
> On Mon, Jun 08, 2009 at 11:02:18PM +0200, Thomas Rast wrote:
>
> > +void die_errno(const char *fmt, ...)
> > +{
> > + va_list params;
> > + char fmt_with_err[1024];
> > +
> > + snprintf(fmt_with_err, sizeof(fmt_with_err), "%s: %s", fmt, strerror(errno));
> > +
> > + va_start(params, fmt);
> > + die_routine(fmt_with_err, params);
> > + va_end(params);
> > +}
>
> 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?
[It's a pity that it seems impossible to add an extra argument to the
va_args...]
--
Thomas Rast
trast@{inf,student}.ethz.ch
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic