[patch for 2.6.26 1/4] vfs: utimensat(): ignore tv_sec if tv_nsec == UTIME_OMIT or UTIME_NOW

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Sunday, June 29, 2008 - 12:59 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=94c70b...
Commit:     94c70b9ba7e9c1036284e779e2fef5be89021533
Parent:     12fd0d3088d27867be68655bcab2b074f2835f60
Author:     Michael Kerrisk <mtk.manpages@googlemail.com>
AuthorDate: Mon Jun 9 21:16:05 2008 -0700
Committer:  Al Viro <viro@zeniv.linux.org.uk>
CommitDate: Mon Jun 23 08:43:04 2008 -0400

    [patch for 2.6.26 1/4] vfs: utimensat(): ignore tv_sec if tv_nsec == UTIME_OMIT or UTIME_NOW
    
    The POSIX.1 draft spec for utimensat() says that if a times[n].tv_nsec
    field is UTIME_OMIT or UTIME_NOW, then the value in the corresponding
    tv_sec field is ignored.  See the last sentence of this para, from
    the spec:
    
        If the tv_nsec field of a timespec structure has
        the special value UTIME_NOW, the file's relevant
        timestamp shall be set to the greatest value
        supported by the file system that is not greater than
        the current time. If the tv_nsec field has the
        special value UTIME_OMIT, the file's relevant
        timestamp shall not be changed. In either case,
        the tv_sec field shall be ignored.
    
    However the current Linux implementation requires the tv_sec value to be
    zero (or the EINVAL error results). This requirement should be removed.
    
    Acked-by: Miklos Szeredi <miklos@szeredi.hu>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Ulrich Drepper <drepper@redhat.com>
    Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/utimes.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/fs/utimes.c b/fs/utimes.c
index 14d3edb..d466bc5 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -173,14 +173,6 @@ asmlinkage long sys_utimensat(int dfd, char __user *filename, struct timespec __
 	if (utimes) {
 		if (copy_from_user(&tstimes, utimes, sizeof(tstimes)))
 			return -EFAULT;
-		if ((tstimes[0].tv_nsec == UTIME_OMIT ||
-		     tstimes[0].tv_nsec == UTIME_NOW) &&
-		    tstimes[0].tv_sec != 0)
-			return -EINVAL;
-		if ((tstimes[1].tv_nsec == UTIME_OMIT ||
-		     tstimes[1].tv_nsec == UTIME_NOW) &&
-		    tstimes[1].tv_sec != 0)
-			return -EINVAL;
 
 		/* Nothing to do, we must not even check the path.  */
 		if (tstimes[0].tv_nsec == UTIME_OMIT &&
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch for 2.6.26 1/4] vfs: utimensat(): ignore tv_sec if ..., Linux Kernel Mailing ..., (Sun Jun 29, 12:59 pm)