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

Victor Toso victortoso at redhat.com
Wed Aug 2 11:18:27 UTC 2017


On Wed, Aug 02, 2017 at 10:57:56AM +0200, marcandre.lureau at redhat.com wrote:
> 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>

Acked-by: Victor Toso <victortoso 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
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170802/af075579/attachment.sig>


More information about the Spice-devel mailing list