From a84dc8b36b534b858007795daa74a3880d7d1596 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 4 Oct 2010 21:35:44 +0200 Subject: [PATCH] read-file tests: Avoid a test failure on NonStop Kernel. * tests/test-read-file.c (main): Don't assume that /etc/resolv.conf is a regular file. Reported by Joachim Schmitz . --- ChangeLog | 7 +++++++ tests/test-read-file.c | 20 ++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f6223ca5..4a556ce56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-10-04 Bruno Haible + + read-file tests: Avoid a test failure on NonStop Kernel. + * tests/test-read-file.c (main): Don't assume that /etc/resolv.conf is + a regular file. + Reported by Joachim Schmitz . + 2010-10-03 Bruno Haible gnulib-tool: Fixes for --create-testdir with --libtool. diff --git a/tests/test-read-file.c b/tests/test-read-file.c index 0a0bf6882..daa61668c 100644 --- a/tests/test-read-file.c +++ b/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); } -- 2.11.0