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

Daniel P. Berrange berrange at redhat.com
Sat Feb 16 17:41:10 UTC 2008


On Fri, Feb 15, 2008 at 10:03:30PM +0100, Jim Meyering wrote:
> "Daniel P. Berrange" <berrange at 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  -=| 




More information about the libvir-list mailing list