Bug 15361 - aio_fsync() should not check file descriptor for "open for writing" mode and return EBADF
Summary: aio_fsync() should not check file descriptor for "open for writing" mode and ...
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.17
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL: http://austingroupbugs.net/view.php?i...
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-12 05:22 UTC by Xavier Roche
Modified: 2014-06-13 18:27 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments
Suggested patch for sysdeps/pthread/aio_fsync.c (357 bytes, patch)
2013-04-12 05:25 UTC, Xavier Roche
Details | Diff
Suggested patch for manual/llio.texi (327 bytes, patch)
2013-04-12 05:39 UTC, Xavier Roche
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Xavier Roche 2013-04-12 05:22:47 UTC
As suggested by Roland McGrath, I'm opening a request regarding the aio_fsync() function returning EBADF when using a file descriptor not "open for writing".

This is actually a minor inconsistency fixed POSIX:
<http://austingroupbugs.net/view.php?id=671>

The suggested change is not to check anymore the file descriptor flags.
Comment 1 Xavier Roche 2013-04-12 05:25:08 UTC
Created attachment 6977 [details]
Suggested patch for sysdeps/pthread/aio_fsync.c

This is a suggested patch for the sysdeps/pthread/aio_fsync.c file. It just replaces the O_RDONLY flag check by a F_GETFL fd check (to ensure the file descriptor is valid) to accommodate the new specification.
Comment 2 Xavier Roche 2013-04-12 05:39:10 UTC
Created attachment 6978 [details]
Suggested patch for manual/llio.texi

Suggested patch for the manual.
Comment 3 Xavier Roche 2013-04-12 05:58:03 UTC
Please see also:

* the related discussion on austin-group-l
http://comments.gmane.org/gmane.comp.standards.posix.austin.general/6952

* the libc-alpha@sourceware.org discussion:
http://sourceware.org/ml/libc-alpha/2013-04/msg00213.html
Comment 4 Roland McGrath 2013-04-12 20:11:54 UTC
Fixed on trunk.