This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi, Hurd's implementations of fdatasync and fsync do not take into account the fact that file_sync could not be implemented in the receiving port, or implemented as stub, returning (E)MIG_BAD_ID or EOPNOTSUPP. Attached there is a patch to normalize them to EINVAL, as specified by POSIX. Thanks, -- Pino Toscano
Hurd: fix fdatasync/fsync if the fd does not support file_sync
Handle the case of the fd port not implementing file_sync (returning MIG_BAD_ID) or implementing a stub (EOPNOTSUPP),
properly returning EINVAL.
2012-08-29 Pino Toscano <toscano.pino@tiscali.it>
* sysdeps/mach/hurd/fdatasync.c: Turn ERR into EINVAL if it is
MIG_BAD_ID or EOPNOTSUPP.
* sysdeps/mach/hurd/fsync.c: Likewise.
--- a/sysdeps/mach/hurd/fdatasync.c
+++ b/sysdeps/mach/hurd/fdatasync.c
@@ -26,6 +26,10 @@ fdatasync (int fd)
{
error_t err = HURD_DPORT_USE (fd, __file_sync (port, 1, 1));
if (err)
- return __hurd_dfail (fd, err);
+ {
+ if (err == MIG_BAD_ID || err == EOPNOTSUPP)
+ err = EINVAL;
+ return __hurd_dfail (fd, err);
+ }
return 0;
}
--- a/sysdeps/mach/hurd/fsync.c
+++ b/sysdeps/mach/hurd/fsync.c
@@ -27,6 +27,10 @@ fsync (fd)
{
error_t err = HURD_DPORT_USE (fd, __file_sync (port, 1, 0));
if (err)
- return __hurd_dfail (fd, err);
+ {
+ if (err == MIG_BAD_ID || err == EOPNOTSUPP)
+ err = EINVAL;
+ return __hurd_dfail (fd, err);
+ }
return 0;
}
Attachment:
signature.asc
Description: This is a digitally signed message part.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |