This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] linux: use F_GETFL to validate futimes fd
- From: Ben Noordhuis <info at bnoordhuis dot nl>
- To: libc-alpha at sourceware dot org
- Cc: Ben Noordhuis <info at bnoordhuis dot nl>
- Date: Sun, 27 Jan 2013 14:32:20 +0100
- Subject: [PATCH] linux: use F_GETFL to validate futimes fd
Use fcntl(F_GETFL) to validate the file descriptor in the futimes()
fallback path.
Before this commit, glibc used fctnl(F_GETFD) to check for EBADF but
F_GETFD has to acquire a RCU read lock and do a fdtable lookup;
F_GETFL just reads the f_flags field of the struct file.
I haven't signed the copyright assignment but I'm happy to renounce all
rights and put it in the public domain it that makes things easier.
Signed-off-by: Ben Noordhuis <info@bnoordhuis.nl>
ChangeLog | 5 +++++
sysdeps/unix/sysv/linux/futimes.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)