[libvirt] [PATCH v2 3/3] iohelper: Don't include newlines in error messages

Daniel P. Berrangé berrange at redhat.com
Tue Feb 19 13:51:37 UTC 2019


On Mon, Feb 18, 2019 at 11:05:50AM -0500, John Ferlan wrote:
> 
> 
> On 2/13/19 7:04 AM, Andrea Bolognani wrote:
> > The newline was pretty arbitrary, and we're better off
> > without it.
> > 
> > Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> > ---
> >  src/util/iohelper.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> 
> I'm mostly ambivalent about this one; however, since
> virGetLastErrorMessage could return a string without a "\n", then
> perhaps it's best to keep the \n since it really doesn't hurt.

Whether or not virGetLastErrorMessage has a trailing "\n" in the
returned string is tangential to what this patch is changing. The
newline being removed here is the one printed after the filename
"path" parameter, not the error message parameter.

> > diff --git a/src/util/iohelper.c b/src/util/iohelper.c
> > index 1ff4a7b314..aed7ef3184 100644
> > --- a/src/util/iohelper.c
> > +++ b/src/util/iohelper.c
> > @@ -236,7 +236,7 @@ main(int argc, char **argv)
> >      return 0;
> >  
> >   error:
> > -    fprintf(stderr, _("%s: failure with %s\n: %s"),
> > +    fprintf(stderr, _("%s: failure with %s: %s"),
> >              program_name, path, virGetLastErrorMessage());
> >      exit(EXIT_FAILURE);

Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list