From: Guy Harris Date: Tue, 1 Sep 2015 00:16:07 +0000 (-0700) Subject: Keep the two line numbers in esp_print_decode_onesecret() separate. X-Git-Tag: tcpdump-4.8.0~179 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/7f3d84de1debf4982944953defefc2f1d604b288?hp=486704db7c840dcfb51f70f1812d9c3ad37ad39c Keep the two line numbers in esp_print_decode_onesecret() separate. 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. --- diff --git a/print-esp.c b/print-esp.c index bcd6094d..5dbb28d4 100644 --- a/print-esp.c +++ b/print-esp.c @@ -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);