From 050ba71ca0edb79d8e002f85e6abd0424bcfdd15 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sat, 17 Sep 2022 14:15:43 +0200 Subject: [PATCH] Fix utime(3) not handling times being NULL. --- libc/utime/utime.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libc/utime/utime.c b/libc/utime/utime.c index 02a96021..68469c85 100644 --- a/libc/utime/utime.c +++ b/libc/utime/utime.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Jonas 'Sortie' Termansen. + * Copyright (c) 2013, 2022 Jonas 'Sortie' Termansen. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -29,6 +29,8 @@ // nice to remove this at some point. int utime(const char* filepath, const struct utimbuf* times) { + if ( !times ) + return utimens(filepath, NULL); struct timespec ts_times[2]; ts_times[0] = timespec_make(times->actime, 0); ts_times[1] = timespec_make(times->modtime, 0);