summaryrefslogtreecommitdiffstats
path: root/usr.bin/tr
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-07-09 05:15:46 +0000
committertjr <tjr@FreeBSD.org>2004-07-09 05:15:46 +0000
commit3e5d71bd1a8c445e99b4335403253a679f3a2d07 (patch)
treefb02ef9c8a5252db84c7f5235dfcc2a1d36db7a7 /usr.bin/tr
parentf4c76ff4de3a4a1fc4c060c05168217f72049a3d (diff)
downloadFreeBSD-src-3e5d71bd1a8c445e99b4335403253a679f3a2d07.zip
FreeBSD-src-3e5d71bd1a8c445e99b4335403253a679f3a2d07.tar.gz
Report input errors instead of ignoring them.
Diffstat (limited to 'usr.bin/tr')
-rw-r--r--usr.bin/tr/tr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/usr.bin/tr/tr.c b/usr.bin/tr/tr.c
index f3ce7ee..4932584 100644
--- a/usr.bin/tr/tr.c
+++ b/usr.bin/tr/tr.c
@@ -138,6 +138,8 @@ main(int argc, char **argv)
lastch = ch;
(void)putwchar(ch);
}
+ if (ferror(stdin))
+ err(1, NULL);
exit(0);
}
@@ -154,6 +156,8 @@ main(int argc, char **argv)
while ((ch = getwchar()) != WEOF)
if (!cset_in(delete, ch))
(void)putwchar(ch);
+ if (ferror(stdin))
+ err(1, NULL);
exit(0);
}
@@ -169,6 +173,8 @@ main(int argc, char **argv)
lastch = ch;
(void)putwchar(ch);
}
+ if (ferror(stdin))
+ err(1, NULL);
exit(0);
}
@@ -324,6 +330,8 @@ endloop:
ch = cmap_lookup(map, ch);
(void)putwchar(ch);
}
+ if (ferror(stdin))
+ err(1, NULL);
exit (0);
}
OpenPOWER on IntegriCloud