summaryrefslogtreecommitdiff
path: root/gl/tests/test-read-file.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/tests/test-read-file.c')
-rw-r--r--gl/tests/test-read-file.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/gl/tests/test-read-file.c b/gl/tests/test-read-file.c
index 0a0bf6882e..daa61668c6 100644
--- a/gl/tests/test-read-file.c
+++ b/gl/tests/test-read-file.c
@@ -52,11 +52,23 @@ main (void)
err = 1;
}
- /* Assume FILE1 is a regular file or a symlink to a regular file. */
- if (len != statbuf.st_size)
+ if (S_ISREG (statbuf.st_mode))
{
- fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE1);
- err = 1;
+ /* FILE1 is a regular file or a symlink to a regular file. */
+ if (len != statbuf.st_size)
+ {
+ fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE1);
+ err = 1;
+ }
+ }
+ else
+ {
+ /* Assume FILE1 is not empty. */
+ if (len == 0)
+ {
+ fprintf (stderr, "Read nothing from %s\n", FILE1);
+ err = 1;
+ }
}
free (out);
}