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

Re: [Libvir] PATCH: 11/16: directory/fs/netfs backend



On Fri, Feb 15, 2008 at 10:03:30PM +0100, Jim Meyering wrote:
> "Daniel P. Berrange" <berrange redhat com> wrote:
> ...
> > +    if (virRun(conn, (char**)mntargv, NULL) < 0) {
> > +        free(src);
> > +        virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, "cannot mount %s on %s: %d",
> > +                              src, pool->def->target.path, strerror(errno));
> 
> format string mismatch.  You probably wanted to include ", error" at the
> end of the arg list, to match the trailing %d.
> 
> If this gets by gcc -Wformat then virStorageReportError needs the usual
> __attribute__((printf business, too.

Good idea.

> BTW, I've seen many cases where a diagnostic includes both
> the string, strerrno(error), and the %d-formatted errno value.
> Does anyone know why these diagnostics include the actual errno value?

Historical habit - we should either remove all the errno values, or add them
everywhere we use strerror. The former is probably best - users seeing these
message don't know what the numbers mean

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 


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