aboutsummaryrefslogtreecommitdiff
path: root/stdio-common
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/test_rdwr.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/stdio-common/test_rdwr.c b/stdio-common/test_rdwr.c
index 7825ca9..0544916 100644
--- a/stdio-common/test_rdwr.c
+++ b/stdio-common/test_rdwr.c
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
+#include <support/xstdio.h>
int
main (int argc, char **argv)
@@ -49,7 +50,7 @@ main (int argc, char **argv)
(void) fputs (hello, f);
rewind (f);
- (void) fgets (buf, sizeof (buf), f);
+ xfgets (buf, sizeof (buf), f);
rewind (f);
(void) fputs (buf, f);
rewind (f);
@@ -104,12 +105,8 @@ main (int argc, char **argv)
if (!lose)
{
rewind (f);
- if (fgets (buf, sizeof (buf), f) == NULL)
- {
- printf ("fgets got %s.\n", strerror(errno));
- lose = 1;
- }
- else if (strcmp (buf, replace))
+ xfgets (buf, sizeof (buf), f);
+ if (strcmp (buf, replace))
{
printf ("Read \"%s\" instead of \"%s\".\n", buf, replace);
lose = 1;