mirror of
https://github.com/opnsense/src.git
synced 2026-04-28 01:28:00 -04:00
improve error handling
This commit is contained in:
parent
a01ca46b9b
commit
72a0982cd5
1 changed files with 5 additions and 2 deletions
|
|
@ -144,7 +144,8 @@ main(int argc, char *argv[])
|
|||
err(1, "%s", argv[0]);
|
||||
|
||||
/* First copy bigram array to stdout. */
|
||||
(void)fgets(bigrams, BGBUFSIZE + 1, fp);
|
||||
if (fgets(bigrams, BGBUFSIZE + 1, fp) == NULL)
|
||||
err(1, "get bigram array");
|
||||
|
||||
if (fwrite(bigrams, 1, BGBUFSIZE, stdout) != BGBUFSIZE)
|
||||
err(1, "stdout");
|
||||
|
|
@ -246,9 +247,11 @@ main(int argc, char *argv[])
|
|||
oldpath = buf2;
|
||||
}
|
||||
}
|
||||
|
||||
/* Non-zero status if there were errors */
|
||||
if (fflush(stdout) != 0 || ferror(stdout))
|
||||
exit(1);
|
||||
errx(1, "stdout");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue