|
@@ -1432,25 +1432,21 @@ int Process::sys$close(int fd)
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
|
|
|
|
-int Process::sys$utime(const char* pathname, const utimbuf* buf)
|
|
|
|
|
|
+int Process::sys$utime(const char* user_path, size_t path_length, const utimbuf* user_buf)
|
|
{
|
|
{
|
|
- SmapDisabler disabler;
|
|
|
|
- if (!validate_read_str(pathname))
|
|
|
|
- return -EFAULT;
|
|
|
|
- if (buf && !validate_read_typed(buf))
|
|
|
|
|
|
+ if (user_buf && !validate_read_typed(user_buf))
|
|
return -EFAULT;
|
|
return -EFAULT;
|
|
- time_t atime;
|
|
|
|
- time_t mtime;
|
|
|
|
- if (buf) {
|
|
|
|
- atime = buf->actime;
|
|
|
|
- mtime = buf->modtime;
|
|
|
|
|
|
+ auto path = get_syscall_path_argument(user_path, path_length);
|
|
|
|
+ if (path.is_error())
|
|
|
|
+ return path.error();
|
|
|
|
+ utimbuf buf;
|
|
|
|
+ if (user_buf) {
|
|
|
|
+ copy_from_user(&buf, user_buf, sizeof(buf));
|
|
} else {
|
|
} else {
|
|
- struct timeval now;
|
|
|
|
- kgettimeofday(now);
|
|
|
|
- mtime = now.tv_sec;
|
|
|
|
- atime = now.tv_sec;
|
|
|
|
|
|
+ auto now = kgettimeofday();
|
|
|
|
+ buf = { now.tv_sec, now.tv_sec };
|
|
}
|
|
}
|
|
- return VFS::the().utime(StringView(pathname), current_directory(), atime, mtime);
|
|
|
|
|
|
+ return VFS::the().utime(path.value(), current_directory(), buf.actime, buf.modtime);
|
|
}
|
|
}
|
|
|
|
|
|
int Process::sys$access(const char* user_path, size_t path_length, int mode)
|
|
int Process::sys$access(const char* user_path, size_t path_length, int mode)
|