[systemd-devel] [PATCH] analyze: fix seg-fault with no cl-argument

Daniel Buch boogiewasthere at gmail.com
Thu Jul 24 14:29:40 PDT 2014


We need to check if argv[1] is set before compare
---
 src/analyze/analyze.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 66e2aab..83da7f5 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -1349,7 +1349,7 @@ int main(int argc, char *argv[]) {
         if (r <= 0)
                 goto finish;
 
-        if (streq(argv[optind], "verify"))
+        if (argv[optind] && streq(argv[optind], "verify"))
                 r = verify_units(argv+optind+1,
                                  arg_user ? SYSTEMD_USER : SYSTEMD_SYSTEM,
                                  arg_man);
-- 
2.0.2



More information about the systemd-devel mailing list