- /* Assume 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;
- }
- free (out);
- }
+ if (S_ISREG (statbuf.st_mode))
+ {
+ /* 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);
+ }