From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Kerrisk Subject: [parch 1/4] vfs: utimensat(): ignore tv_sec if tv_nsec == UTIME_OMIT or UTIME_NOW Date: Wed, 04 Jun 2008 00:24:52 +0200 Message-ID: <4845C4B4.8040706@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: lkml , Christoph Hellwig , Miklos Szeredi , Al Viro , jamie@shareable.org, Ulrich Drepper , linux-fsdevel@vger.kernel.org, Subrata Modak To: Andrew Morton Return-path: Received: from mu-out-0910.google.com ([209.85.134.189]:19831 "EHLO mu-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753336AbYFCWZX (ORCPT ); Tue, 3 Jun 2008 18:25:23 -0400 Received: by mu-out-0910.google.com with SMTP id w8so1701689mue.1 for ; Tue, 03 Jun 2008 15:25:21 -0700 (PDT) Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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. However the current Linux implementation requires the tv_sec value to be zero (or the EINVAL error results). This requirement should be removed. CC: Miklos Szeredi CC: Al Viro CC: Ulrich Drepper Signed-off-by: Michael Kerrisk --- linux-2.6.26-rc4/fs/utimes.c 2008-06-03 22:43:15.000000000 +0200 +++ linux-2.6.26-rc4-utimensat-fix-v4/fs/utimes.c 2008-06-03 22:41:50.000000000 +0200 @@ -169,14 +169,6 @@ 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 &&