This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[patch] futimens and AT_FDCWD
- From: Eric Blake <ebb9 at byu dot net>
- To: libc-alpha at sourceware dot org
- Date: Sat, 10 Oct 2009 09:44:05 -0600
- Subject: [patch] futimens and AT_FDCWD
futimens(AT_FDCWD,NULL) should not attempt to change the times of ".". OK
to commit?
2009-10-10 Eric Blake <ebb9@byu.net>
* sysdeps/unix/sysv/linux/futimens.c (futimens): Reject AT_FDCWD.
--
Don't work too hard, make some time for fun as well!
Eric Blake ebb9@byu.net
>From 92cec80f9d7f0bd891d2004015bf52cf4ee3104a Mon Sep 17 00:00:00 2001
From: Eric Blake <ebb9@byu.net>
Date: Sat, 10 Oct 2009 08:54:49 -0600
Subject: [PATCH] Fix futimens(AT_FDCWD,NULL).
---
ChangeLog | 4 ++++
sysdeps/unix/sysv/linux/futimens.c | 7 ++++++-
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/futimens.c b/sysdeps/unix/sysv/linux/futimens.c
index 67f2588..3330607 100644
--- a/sysdeps/unix/sysv/linux/futimens.c
+++ b/sysdeps/unix/sysv/linux/futimens.c
@@ -1,5 +1,5 @@
/* Change access and modification times of open file. Linux version.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -33,6 +33,11 @@ int
futimens (int fd, const struct timespec tsp[2])
{
#ifdef __NR_utimensat
+ if (fd < 0)
+ {
+ __set_errno (EBADF);
+ return -1;
+ }
return INLINE_SYSCALL (utimensat, 4, fd, NULL, tsp, 0);
#else
__set_errno (ENOSYS);
--
1.6.5.rc1