From d68f1b813cf864272e923fbd64932e7ae2ba85cd Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 23 Nov 2013 00:38:47 +0100 Subject: [PATCH] coverity: really fix popt issue --- src/daemon/lldpd.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/daemon/lldpd.c b/src/daemon/lldpd.c index 9cff3bfb..499cd519 100644 --- a/src/daemon/lldpd.c +++ b/src/daemon/lldpd.c @@ -1295,12 +1295,13 @@ lldpd_main(int argc, char *argv[], char *envp[]) /* * Get and parse command line options */ - popt = strchr(opts, '@'); - for (i=0; - protos[i].mode != 0 && popt && *popt != '\0'; - i++) - *(popt++) = protos[i].arg; - *popt = '\0'; + if ((popt = strchr(opts, '@')) != NULL) { + for (i=0; + protos[i].mode != 0 && *popt != '\0'; + i++) + *(popt++) = protos[i].arg; + *popt = '\0'; + } while ((ch = getopt(argc, argv, opts)) != -1) { switch (ch) { case 'h': -- 2.39.5