]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
coverity: really fix popt issue
authorVincent Bernat <bernat@luffy.cx>
Fri, 22 Nov 2013 23:38:47 +0000 (00:38 +0100)
committerVincent Bernat <bernat@luffy.cx>
Fri, 22 Nov 2013 23:49:35 +0000 (00:49 +0100)
src/daemon/lldpd.c

index 9cff3bfb8bdbb93849eeae26dec9751e270bb90d..499cd519bbf77f7626f381979e1de54e2f75d667 100644 (file)
@@ -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':