Fix utime(3) not handling times being NULL.

This commit is contained in:
Jonas 'Sortie' Termansen 2022-09-17 14:15:43 +02:00
parent 0e119b8480
commit 050ba71ca0
1 changed files with 3 additions and 1 deletions

View File

@ -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);