From: Vincent Bernat Date: Fri, 22 Nov 2013 23:38:47 +0000 (+0100) Subject: coverity: really fix popt issue X-Git-Tag: 0.7.8~68 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d68f1b813cf864272e923fbd64932e7ae2ba85cd;p=thirdparty%2Flldpd.git coverity: really fix popt issue --- 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':