# HG changeset patch # User Bruno Haible # Date 1319719445 -7200 # Node ID 19758b0c3160760d5599aa7dae87e6f016081cfc # Parent 2f6844abf7fd80570d2158c4434e36dd4efaa4a9 utimensat: Work around problem on Linux/hppa. * lib/utimensat.c (rpl_utimensat) [Linux/hppa]: Reject invalid tv_nsec values. * doc/posix-functions/utimensat.texi: Mention the problem on Linux/hppa. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-10-27 Bruno Haible + + utimensat: Work around problem on Linux/hppa. + * lib/utimensat.c (rpl_utimensat) [Linux/hppa]: Reject invalid tv_nsec + values. + * doc/posix-functions/utimensat.texi: Mention the problem on Linux/hppa. + 2011-10-25 Jim Meyering maint.mk: fix a bug in sc_prohibit_stddef_without_use diff --git a/doc/posix-functions/utimensat.texi b/doc/posix-functions/utimensat.texi --- a/doc/posix-functions/utimensat.texi +++ b/doc/posix-functions/utimensat.texi @@ -34,6 +34,10 @@ When using @code{UTIME_OMIT} for the modification time, but specifying an access time, some systems fail to update the change time: Linux kernel 2.6.32. +@item +Out-of-range values of @code{tv_nsec} do not lead to a failure on some +platforms: +Linux kernel 2.6.22.19 on hppa. @end itemize Portability problems not fixed by Gnulib: diff --git a/lib/utimensat.c b/lib/utimensat.c --- a/lib/utimensat.c +++ b/lib/utimensat.c @@ -84,6 +84,21 @@ ts[1] = times[1]; times = ts; } +# ifdef __hppa__ + /* Linux kernel 2.6.22.19 on hppa does not reject invalid tv_nsec + values. */ + else if (times + && ((times[0].tv_nsec != UTIME_NOW + && (times[0].tv_nsec < 0 + || times[0].tv_nsec >= 1000000000)) + || (times[1].tv_nsec != UTIME_NOW + && (times[1].tv_nsec < 0 + || times[1].tv_nsec >= 1000000000)))) + { + errno = EINVAL; + return -1; + } +# endif # endif /* __linux__ */ result = utimensat (fd, file, times, flag); /* Linux kernel 2.6.25 has a bug where it returns EINVAL for