]> sourceware.org Git - glibc.git/commitdiff
Linux: Use AT_FDCWD in utime, utimes when calling utimensat
authorFlorian Weimer <fweimer@redhat.com>
Thu, 5 Mar 2020 15:09:52 +0000 (16:09 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Thu, 5 Mar 2020 15:09:52 +0000 (16:09 +0100)
0 is a valid descriptor without any special meaning.

Reviewed-by: Lukasz Majewski <lukma@denx.de>
sysdeps/unix/sysv/linux/utime.c
sysdeps/unix/sysv/linux/utimes.c

index 2cd9334a6f1efc36052cff93b3588d3acf43dd62..8665ef26362b9563738be118ac56815d62afa0bc 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <utime.h>
 #include <time.h>
+#include <fcntl.h>
 
 int
 __utime64 (const char *file, const struct __utimbuf64 *times)
@@ -32,7 +33,7 @@ __utime64 (const char *file, const struct __utimbuf64 *times)
       ts64[1].tv_nsec = 0LL;
     }
 
-  return __utimensat64_helper (0, file, times ? ts64 : NULL, 0);
+  return __utimensat64_helper (AT_FDCWD, file, times ? ts64 : NULL, 0);
 }
 
 #if __TIMESIZE != 64
index 75927b6ec6695c96e32f9d565a824309e965b752..a6809876fdd0df511ddb042b6fa5d53e2d28200e 100644 (file)
@@ -17,6 +17,7 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <time.h>
+#include <fcntl.h>
 
 int
 __utimes64 (const char *file, const struct __timeval64 tvp[2])
@@ -29,7 +30,7 @@ __utimes64 (const char *file, const struct __timeval64 tvp[2])
       ts64[1] = timeval64_to_timespec64 (tvp[1]);
     }
 
-  return __utimensat64_helper (0, file, tvp ? ts64 : NULL, 0);
+  return __utimensat64_helper (AT_FDCWD, file, tvp ? ts64 : NULL, 0);
 }
 
 #if __TIMESIZE != 64
This page took 0.048597 seconds and 5 git commands to generate.