[Spice-devel] [PATCH libcacard] vscclient: handle ? option

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Wed Aug 2 08:57:56 UTC 2017


From: Marc-André Lureau <marcandre.lureau at redhat.com>

Unknown option fallbacks to '?' case.
Keep the assert(optarg) for scan-build.

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1477322

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 src/vscclient.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/vscclient.c b/src/vscclient.c
index 0954b3f..fa60162 100644
--- a/src/vscclient.c
+++ b/src/vscclient.c
@@ -679,8 +679,11 @@ main(
 #endif
 
     while ((c = getopt(argc, argv, "c:e:d:")) != -1) {
-        assert(optarg != NULL);
+        if (c == '?') {
+            break;
+        }
 
+        assert(optarg != NULL);
         switch (c) {
         case 'c':
             if (cert_count >= MAX_CERTS) {
-- 
2.14.0.rc0.1.g40ca67566



More information about the Spice-devel mailing list