about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-02-03 15:17:07 +0000
committerRoland McGrath <roland@gnu.org>1999-02-03 15:17:07 +0000
commitd3132360758aeb3013e10c70a4beb54aa6347b9f (patch)
tree5841aefe2a2c913f5544d31da6e32d6caca1cc27 /sysdeps
parentd24adae5c0a9093d31881c0cb74b4cc86a8a42eb (diff)
downloadglibc-d3132360758aeb3013e10c70a4beb54aa6347b9f.tar.gz
glibc-d3132360758aeb3013e10c70a4beb54aa6347b9f.tar.xz
glibc-d3132360758aeb3013e10c70a4beb54aa6347b9f.zip
1999-02-03 Mark Kettenis <kettenis@gnu.org>
* sysdeps/mach/hurd/utimes.c (__utimes): Deal with TVP being NULL.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/mach/hurd/utimes.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/sysdeps/mach/hurd/utimes.c b/sysdeps/mach/hurd/utimes.c
index 80f6572e06..aec7d5d2af 100644
--- a/sysdeps/mach/hurd/utimes.c
+++ b/sysdeps/mach/hurd/utimes.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 97, 99 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -28,13 +28,24 @@ __utimes (file, tvp)
      const char *file;
      struct timeval tvp[2];
 {
+  struct timeval timevals[2];
   error_t err;
-  file_t f = __file_name_lookup (file, 0, 0);
-  if (f == MACH_PORT_NULL)
+  file_t port;
+
+  if (tvp == NULL)
+    {
+      /* Setting the number of microseconds to `-1' tells the
+         underlying filesystems to use the current time.  */
+      timevals[1].tv_usec = timevals[0].tv_usec = (time_t)-1;
+      tvp = timevals;
+    }
+
+  port = __file_name_lookup (file, 0, 0);
+  if (port == MACH_PORT_NULL)
     return -1;
-  err = __file_utimes (f,
+  err = __file_utimes (port,
 		       *(time_value_t *) &tvp[0], *(time_value_t *) &tvp[1]);
-  __mach_port_deallocate (__mach_task_self (), f);
+  __mach_port_deallocate (__mach_task_self (), port);
   if (err)
     return __hurd_fail (err);
   return 0;