]> Savannah Git Hosting - gnulib.git/commitdiff
utimensat: Work around problem on Linux/hppa.
authorBruno Haible <bruno@clisp.org>
Thu, 27 Oct 2011 12:44:05 +0000 (14:44 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 27 Oct 2011 12:44:05 +0000 (14:44 +0200)
* lib/utimensat.c (rpl_utimensat) [Linux/hppa]: Reject invalid tv_nsec
values.
* doc/posix-functions/utimensat.texi: Mention the problem on Linux/hppa.

ChangeLog
doc/posix-functions/utimensat.texi
lib/utimensat.c

index 546005ed085e91b1afb71cad98f23985938d6b04..5fd57d3497d6c0ac61cabb2000ad24131efbae88 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-10-27  Bruno Haible  <bruno@clisp.org>
+
+       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  <meyering@redhat.com>
 
        maint.mk: fix a bug in sc_prohibit_stddef_without_use
index bcc06d6bc6491868f7a9ccc8295bed72e719af93..3d69c6f8b2639c14b2592e8f37973685aa6c5837 100644 (file)
@@ -34,6 +34,10 @@ Linux kernel 2.6.25.
 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:
index 5a55e64f7290711500df75ea0ed6789101f5e8d7..37f0ea89e3a41d376b14d6085ab8822caa18f735 100644 (file)
@@ -84,6 +84,21 @@ rpl_utimensat (int fd, char const *file, struct timespec const times[2],
             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