Commit 94c70b9ba7e9c1036284e779e2fef5be89021533
Committed by
Al Viro
1 parent
12fd0d3088
Exists in
master
and in
7 other branches
[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>
Showing 1 changed file with 0 additions and 8 deletions Side-by-side Diff
fs/utimes.c
... | ... | @@ -173,14 +173,6 @@ |
173 | 173 | if (utimes) { |
174 | 174 | if (copy_from_user(&tstimes, utimes, sizeof(tstimes))) |
175 | 175 | return -EFAULT; |
176 | - if ((tstimes[0].tv_nsec == UTIME_OMIT || | |
177 | - tstimes[0].tv_nsec == UTIME_NOW) && | |
178 | - tstimes[0].tv_sec != 0) | |
179 | - return -EINVAL; | |
180 | - if ((tstimes[1].tv_nsec == UTIME_OMIT || | |
181 | - tstimes[1].tv_nsec == UTIME_NOW) && | |
182 | - tstimes[1].tv_sec != 0) | |
183 | - return -EINVAL; | |
184 | 176 | |
185 | 177 | /* Nothing to do, we must not even check the path. */ |
186 | 178 | if (tstimes[0].tv_nsec == UTIME_OMIT && |