Hey David, David Herrmann [2014-11-28 15:49 +0100]: > Why not fix all those other occurrences with one fix by changing > hostnamectl_main() the last line from: > return r < 0 ? EXIT_FAILURE : r; > to > return r < 0 ? EXIT_FAILURE : 0; > > Usually, >=0 means success, <0 failure, in systemd. We should not > return !=0 from main() if the return value wasn't negative.
Yeah, that's even more robust and guards against similar errors in the future. Updated patch attached. Martin -- Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
From c8c55d0aa621ad2998b15ff461b20b3fcb1361b0 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(). Exit with zero in main() on all nonnegative results to guard against similar errors. --- 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..ff4e9c9 100644 --- a/src/hostname/hostnamectl.c +++ b/src/hostname/hostnamectl.c @@ -536,5 +536,5 @@ int main(int argc, char *argv[]) { r = hostnamectl_main(bus, argc, argv); finish: - return r < 0 ? EXIT_FAILURE : r; + return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; } -- 2.1.3
signature.asc
Description: Digital signature
_______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
