diff options
Diffstat (limited to 'libc/bionic/utimes.cpp')
-rw-r--r-- | libc/bionic/utimes.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libc/bionic/utimes.cpp b/libc/bionic/utimes.cpp index 8950972a6..65f2d0b76 100644 --- a/libc/bionic/utimes.cpp +++ b/libc/bionic/utimes.cpp @@ -34,9 +34,13 @@ int utimes(const char* path, const timeval tv[2]) { timespec ts[2]; - if (!timespec_from_timeval(ts[0], tv[0]) || !timespec_from_timeval(ts[1], tv[1])) { - errno = EINVAL; - return -1; + timespec* ts_ptr = NULL; + if (tv != NULL) { + if (!timespec_from_timeval(ts[0], tv[0]) || !timespec_from_timeval(ts[1], tv[1])) { + errno = EINVAL; + return -1; + } + ts_ptr = ts; } - return utimensat(AT_FDCWD, path, ts, 0); + return utimensat(AT_FDCWD, path, ts_ptr, 0); } |