Skip to content

Commit

Permalink
improved some ERROR messages
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jan 6, 2025
1 parent ae4b1cb commit ad27da5
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions hcxpcapngtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -5779,7 +5779,7 @@ jtrbasenamedeprecated = pcapinname;
fd_pcap = open(pcapnameptr, O_RDONLY);
if(fd_pcap == -1)
{
perror("failed to open file");
fprintf(stdout, "failed to open %s: %s\n", pcapnameptr, strerror(errno));
return false;
}
magicnumber = getmagicnumber(fd_pcap);
Expand Down Expand Up @@ -5856,7 +5856,7 @@ static uint8_t packet[MAXPACPSNAPLEN];
if(initlists() == false) return false;
if((fh_raw_in = fopen(rawinname, "r")) == NULL)
{
fprintf(stderr, "failed to open raw file %s\n", rawinname);
fprintf(stdout, "failed to open raw file %s\n", rawinname);
return false;
}
linecount = 0;
Expand Down Expand Up @@ -6656,119 +6656,119 @@ if(pmkideapoloutname != NULL)
{
if((fh_pmkideapol = fopen(pmkideapoloutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", pmkideapoloutname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", pmkideapoloutname, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(eapmd5outname != NULL)
{
if((fh_eapmd5 = fopen(eapmd5outname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", eapmd5outname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", eapmd5outname, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(eapmd5johnoutname != NULL)
{
if((fh_eapmd5john = fopen(eapmd5johnoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", eapmd5johnoutname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", eapmd5johnoutname, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(eapleapoutname != NULL)
{
if((fh_eapleap = fopen(eapleapoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", eapleapoutname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", eapleapoutname, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(tacacspoutname != NULL)
{
if((fh_tacacsp = fopen(tacacspoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", tacacspoutname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", tacacspoutname, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(essidoutname != NULL)
{
if((fh_essid = fopen(essidoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", essidoutname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", essidoutname, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(ltsoutname != NULL)
{
if((fh_lts = fopen(ltsoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", ltsoutname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", ltsoutname, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(essidproberequestoutname != NULL)
{
if((fh_essidproberequest = fopen(essidproberequestoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", essidproberequestoutname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", essidproberequestoutname, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(identityoutname != NULL)
{
if((fh_identity = fopen(identityoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", identityoutname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", identityoutname, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(usernameoutname != NULL)
{
if((fh_username = fopen(usernameoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", usernameoutname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", usernameoutname, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(deviceinfooutname != NULL)
{
if((fh_deviceinfo = fopen(deviceinfooutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", deviceinfooutname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", deviceinfooutname, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(nmeaoutname != NULL)
{
if((fh_nmea = fopen(nmeaoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", nmeaoutname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", nmeaoutname, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(csvoutname != NULL)
{
if((fh_csv = fopen(csvoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", csvoutname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", csvoutname, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(rawoutname != NULL)
{
if((fh_raw_out = fopen(rawoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n",rawoutname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n",rawoutname, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(logoutname != NULL)
{
if((fh_log = fopen(logoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n",logoutname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n",logoutname, strerror(errno));
exit(EXIT_FAILURE);
}
}
Expand All @@ -6777,7 +6777,7 @@ if(pmkidclientoutname != NULL)
{
if((fh_pmkideapolclient = fopen(pmkidclientoutname, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", pmkidclientoutname, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", pmkidclientoutname, strerror(errno));
exit(EXIT_FAILURE);
}
}
Expand All @@ -6786,7 +6786,7 @@ if(pmkideapoljtroutnamedeprecated != NULL)
{
if((fh_pmkideapoljtrdeprecated = fopen(pmkideapoljtroutnamedeprecated, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", pmkideapoljtroutnamedeprecated, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", pmkideapoljtroutnamedeprecated, strerror(errno));
exit(EXIT_FAILURE);
}
}
Expand All @@ -6795,23 +6795,23 @@ if(pmkidoutnamedeprecated != NULL)
{
if((fh_pmkiddeprecated = fopen(pmkidoutnamedeprecated, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", pmkidoutnamedeprecated, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", pmkidoutnamedeprecated, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(hccapxoutnamedeprecated != NULL)
{
if((fh_hccapxdeprecated = fopen(hccapxoutnamedeprecated, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", hccapxoutnamedeprecated, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", hccapxoutnamedeprecated, strerror(errno));
exit(EXIT_FAILURE);
}
}
if(hccapoutnamedeprecated != NULL)
{
if((fh_hccapdeprecated = fopen(hccapoutnamedeprecated, "a")) == NULL)
{
fprintf(stdout, "error opening file %s: %s\n", hccapoutnamedeprecated, strerror(errno));
fprintf(stdout, "failed to open file %s: %s\n", hccapoutnamedeprecated, strerror(errno));
exit(EXIT_FAILURE);
}
}
Expand Down

0 comments on commit ad27da5

Please sign in to comment.