[systemd-devel] [PATCH] systemd-verify: call help() and exit if no CL-argument

Daniel Buch boogiewasthere at gmail.com
Mon Jul 21 11:04:33 PDT 2014


Im not sure if we want the help approach or just fail?

I can change this and resed if you want.

Assertion 'strv_uniq(ans)' failed at src/verify/verify.c:53, function generate_path(). Aborting.
[1]    4795 abort (core dumped)  systemd-verify
---
 src/verify/verify.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/verify/verify.c b/src/verify/verify.c
index c1a3da8..b9f4372 100644
--- a/src/verify/verify.c
+++ b/src/verify/verify.c
@@ -300,13 +300,20 @@ static int parse_argv(int argc, char *argv[]) {
                 {}
         };
 
-        int c;
+        int c, left;
 
         assert(argc >= 1);
         assert(argv);
 
         opterr = 0;
 
+        left = argc - optind;
+
+        if (left <= 0) {
+                help();
+                return -EINVAL;
+        }
+
         while ((c = getopt_long(argc, argv, ":h", options, NULL)) >= 0)
                 switch (c) {
 
-- 
2.0.2



More information about the systemd-devel mailing list