about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/fdatasync.c
diff options
context:
space:
mode:
authorPino Toscano <toscano.pino@tiscali.it>2012-10-29 19:35:56 +0100
committerPino Toscano <toscano.pino@tiscali.it>2012-10-29 19:35:56 +0100
commit94ce799f82a1d3b7453b1942016f91334c838b85 (patch)
tree71d72c0ee1517df4455f3cc9ec83631a3411f621 /sysdeps/mach/hurd/fdatasync.c
parent8bece75210704b1c667087f9c2b71af64a68cb53 (diff)
downloadglibc-94ce799f82a1d3b7453b1942016f91334c838b85.tar.gz
glibc-94ce799f82a1d3b7453b1942016f91334c838b85.tar.xz
glibc-94ce799f82a1d3b7453b1942016f91334c838b85.zip
Hurd: fix fdatasync/fsync if the fd does not support file_sync
Handle the case of the fd port implementing a stub (EOPNOTSUPP),
properly returning EINVAL.
Diffstat (limited to 'sysdeps/mach/hurd/fdatasync.c')
-rw-r--r--sysdeps/mach/hurd/fdatasync.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sysdeps/mach/hurd/fdatasync.c b/sysdeps/mach/hurd/fdatasync.c
index 19d7a4a58a..22c1d103d4 100644
--- a/sysdeps/mach/hurd/fdatasync.c
+++ b/sysdeps/mach/hurd/fdatasync.c
@@ -26,6 +26,12 @@ fdatasync (int fd)
 {
   error_t err = HURD_DPORT_USE (fd, __file_sync (port, 1, 1));
   if (err)
-    return __hurd_dfail (fd, err);
+    {
+      if (err == EOPNOTSUPP)
+	/* If the file descriptor does not support sync, return EINVAL
+	   as POSIX specifies.  */
+	err = EINVAL;
+      return __hurd_dfail (fd, err);
+    }
   return 0;
 }