]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Keep the two line numbers in esp_print_decode_onesecret() separate.
authorGuy Harris <[email protected]>
Tue, 1 Sep 2015 00:16:07 +0000 (17:16 -0700)
committerGuy Harris <[email protected]>
Tue, 1 Sep 2015 00:16:07 +0000 (17:16 -0700)
Have the line number for the file we're opening for "file" be separate
from the line number we're passed.  That avoids warnings, and makes it
clearer *which* line number we're using.

print-esp.c

index bcd6094d8b9e61af3c84f70fdfc8b68a39e504ef..5dbb28d4cd2be2810f6120bb1ed7fe73d6f100af 100644 (file)
@@ -432,7 +432,7 @@ static void esp_print_decode_onesecret(netdissect_options *ndo, char *line,
                /* open file and read it */
                FILE *secretfile;
                char  fileline[1024];
-               int   lineno=0;
+               int   subfile_lineno=0;
                char  *nl;
                char *filename = line;
 
@@ -443,7 +443,7 @@ static void esp_print_decode_onesecret(netdissect_options *ndo, char *line,
                }
 
                while (fgets(fileline, sizeof(fileline)-1, secretfile) != NULL) {
-                       lineno++;
+                       subfile_lineno++;
                        /* remove newline from the line */
                        nl = strchr(fileline, '\n');
                        if (nl)
@@ -451,7 +451,7 @@ static void esp_print_decode_onesecret(netdissect_options *ndo, char *line,
                        if (fileline[0] == '#') continue;
                        if (fileline[0] == '\0') continue;
 
-                       esp_print_decode_onesecret(ndo, fileline, filename, lineno);
+                       esp_print_decode_onesecret(ndo, fileline, filename, subfile_lineno);
                }
                fclose(secretfile);