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.
This commit is contained in:
Guy Harris 2015-08-31 17:16:07 -07:00
parent 486704db7c
commit 7f3d84de1d

View 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);