- changed status to resolved
uniq(1) doesn't trap file write error.
Issue #110
resolved
uniq(1) doesn't trap I/O error expect fopen(3).
first, fgetln(3) return NULL not only EOF but I/O error, so it should be checked by ferror(3).
while ((p = fgetln(ifp, &psize)) != NULL) {
...
}
show(ofp, prevline);
free(prevline);
second, fprintf(3)'s return value never checked:
if ((dflag && repeats == 0) || (uflag && repeats > 0))
return;
if (cflag) {
(void)fprintf(ofp, "%4d %s", repeats + 1, str);
} else {
(void)fprintf(ofp, "%s", str);
Comments (1)
-
reporter - Log in to comment
import new 2-claus BSDL uniq(1) implementation, for following PR: BUGFIX: Issue
#108- uniq(1) doesn't recognize '-' as stdin. BUGFIX: Issue#109- uniq(1) use isspace(3b) instead of isblank(3) to parse field separator. BUGFIX: Issue#110- uniq(1) doesn't trap file write error. ENHANCEMENT: Issue#106- implement GNU uniq(1) extension.→ <<cset 4d704feba757>>