hurd: Make O_TRUNC update mtime/ctime

* hurd/lookup-retry.c (__hurd_file_name_lookup_retry): Call
__file_utimens after __file_set_size.
This commit is contained in:
Samuel Thibault 2020-03-29 19:42:55 +02:00
parent a1a486d70e
commit e095db0bc6

View File

@ -178,8 +178,17 @@ __hurd_file_name_lookup_retry (error_t (*use_init_port)
/* We got a successful translation. Now apply any open-time
action flags we were passed. */
if (!err && (flags & O_TRUNC)) /* Asked to truncate the file. */
err = __file_set_size (*result, 0);
if (!err && (flags & O_TRUNC))
{
/* Asked to truncate the file. */
err = __file_set_size (*result, 0);
if (!err)
{
struct timespec atime = { 0, UTIME_OMIT };
struct timespec mtime = { 0, UTIME_NOW };
__file_utimens (*result, atime, mtime);
}
}
if (err)
__mach_port_deallocate (__mach_task_self (), *result);