[libvirt] [PATCH] iohelper: Remove remaining newlines from error messages

Andrea Bolognani posted 1 patch 5 years, 1 month ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20190219150701.7884-1-abologna@redhat.com
src/util/iohelper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[libvirt] [PATCH] iohelper: Remove remaining newlines from error messages
Posted by Andrea Bolognani 5 years, 1 month ago
The iohelper is an internal program that's only supposed to
be called by libvirt, and whatever output it might produce
will ultimately be passed to virReportError() or similar.

Since we do not want strings passed to those functions to
contain newlines, we can simply not output them in the first
place.

This is what happens in pretty much all cases already, but
in a couple instances newlines have managed to slip in.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/util/iohelper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/iohelper.c b/src/util/iohelper.c
index aed7ef3184..ddc338b7c7 100644
--- a/src/util/iohelper.c
+++ b/src/util/iohelper.c
@@ -181,7 +181,7 @@ usage(int status)
     if (status) {
         fprintf(stderr, _("%s: try --help for more details"), program_name);
     } else {
-        printf(_("Usage: %s FILENAME FD\n"), program_name);
+        printf(_("Usage: %s FILENAME FD"), program_name);
     }
     exit(status);
 }
@@ -198,7 +198,7 @@ main(int argc, char **argv)
     if (virGettextInitialize() < 0 ||
         virThreadInitialize() < 0 ||
         virErrorInitialize() < 0) {
-        fprintf(stderr, _("%s: initialization failed\n"), program_name);
+        fprintf(stderr, _("%s: initialization failed"), program_name);
         exit(EXIT_FAILURE);
     }
 
-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] iohelper: Remove remaining newlines from error messages
Posted by Laine Stump 5 years, 1 month ago
On 2/19/19 10:07 AM, Andrea Bolognani wrote:
> The iohelper is an internal program that's only supposed to
> be called by libvirt, and whatever output it might produce
> will ultimately be passed to virReportError() or similar.
>
> Since we do not want strings passed to those functions to
> contain newlines, we can simply not output them in the first
> place.
>
> This is what happens in pretty much all cases already, but
> in a couple instances newlines have managed to slip in.
>
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>


Reviewed-by: Laine Stump <laine@laine.org>


> ---
>   src/util/iohelper.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/util/iohelper.c b/src/util/iohelper.c
> index aed7ef3184..ddc338b7c7 100644
> --- a/src/util/iohelper.c
> +++ b/src/util/iohelper.c
> @@ -181,7 +181,7 @@ usage(int status)
>       if (status) {
>           fprintf(stderr, _("%s: try --help for more details"), program_name);
>       } else {
> -        printf(_("Usage: %s FILENAME FD\n"), program_name);
> +        printf(_("Usage: %s FILENAME FD"), program_name);
>       }
>       exit(status);
>   }
> @@ -198,7 +198,7 @@ main(int argc, char **argv)
>       if (virGettextInitialize() < 0 ||
>           virThreadInitialize() < 0 ||
>           virErrorInitialize() < 0) {
> -        fprintf(stderr, _("%s: initialization failed\n"), program_name);
> +        fprintf(stderr, _("%s: initialization failed"), program_name);
>           exit(EXIT_FAILURE);
>       }
>   


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list