[PATCH] linux: use F_GETFL to validate futimes fd

Ben Noordhuis info@bnoordhuis.nl
Sun Jan 27 13:32:00 GMT 2013


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(-)



More information about the Libc-alpha mailing list