summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/tst-fallocate-common.c
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.com>2016-10-17 16:59:17 -0200
committerAdhemerval Zanella <adhemerval.zanella@linaro.com>2016-10-18 08:56:22 -0200
commita9bfffe59333fdc6785f3cc903188d1ead36539d (patch)
tree16f9f81101469354fbc868fd199af2c962a3005b /sysdeps/unix/sysv/linux/tst-fallocate-common.c
parentb3d17c1cf29ac8cd6b2fcd1db7d824e4af9ea505 (diff)
downloadglibc-a9bfffe59333fdc6785f3cc903188d1ead36539d.tar.gz
glibc-a9bfffe59333fdc6785f3cc903188d1ead36539d.tar.xz
glibc-a9bfffe59333fdc6785f3cc903188d1ead36539d.zip
Fix Linux fallocate tests for EOPNOTSUPP
The fallocate syscall might fail on Linux due missing support from
underlying filesystem (for instance some NFS versions).  This patch
adds this check for fallocate tests.  It also moves tst-fallocate{64}
to 'io' folder (since it is on fallocate{64} is built).

Checked on x86_64.

	* sysdeps/unix/sysv/linux/Makefile [$(subdir) = math] (tests): Move
	tst-fallocate{64}.
	* sysdeps/unix/sysv/linux/tst-fallocate-common.c: Check for EOPNOTSUPP
	on syscall return.
Diffstat (limited to 'sysdeps/unix/sysv/linux/tst-fallocate-common.c')
-rw-r--r--sysdeps/unix/sysv/linux/tst-fallocate-common.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sysdeps/unix/sysv/linux/tst-fallocate-common.c b/sysdeps/unix/sysv/linux/tst-fallocate-common.c
index 9879488687..d98bf4a3e6 100644
--- a/sysdeps/unix/sysv/linux/tst-fallocate-common.c
+++ b/sysdeps/unix/sysv/linux/tst-fallocate-common.c
@@ -58,7 +58,13 @@ do_test_with_offset (off_t offset)
      and check if both buffer have the same contents.  */
   ret = fallocate (temp_fd, 0, offset, BLK_SIZE);
   if (ret == -1)
-    FAIL_EXIT1 ("fallocate failed");
+    {
+      /* fallocate might not be fully supported by underlying filesystem (for
+	 instance some NFS versions).   */
+      if (errno == EOPNOTSUPP)
+	FAIL_EXIT (77, "fallocate not supported");
+      FAIL_EXIT1 ("fallocate failed");
+    }
 
   ret = fstat (temp_fd, &finfo);
   if (ret == -1)