Hello all,

while packaging 217 my integration tests for hostnamed yelled at me
that hostnamectl fails. Indeed it exits with 1 now even though it
succeeds.

Trivial patch attached. OK to push?

Thanks,

Martin
-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
From 416e06379d58a3f5b22cf3bd3ad587cc59b10c3e Mon Sep 17 00:00:00 2001
From: Martin Pitt <[email protected]>
Date: Fri, 28 Nov 2014 15:38:05 +0100
Subject: [PATCH] hostnamectl: Exit with zero on success

In show_all_names(), bus_map_all_properties() returns 1 on success which is
then used as the return code of show_all_names() and eventually main(). As for
a shell command nonzero signals failure, and the documentation also says "0 on
success", fix show_all_names() to return 0 on success just like show_one_name()
and the other dispatchers.
---
 src/hostname/hostnamectl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index e487369..acd107d 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -216,7 +216,7 @@ fail:
         free(info.virtualization);
         free(info.architecture);
 
-        return r;
+        return r < 0 ? r : 0;
 }
 
 static int show_status(sd_bus *bus, char **args, unsigned n) {
-- 
2.1.3

Attachment: signature.asc
Description: Digital signature

_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to