From f4315054b46d5e58b44a709a51943fb73f846afb Mon Sep 17 00:00:00 2001 From: Sergey Bugaev Date: Sun, 12 Feb 2023 14:10:33 +0300 Subject: hurd: Use mach_msg_type_number_t where appropriate It has been decided that on x86_64, mach_msg_type_number_t stays 32-bit. Therefore, it's not possible to use mach_msg_type_number_t interchangeably with size_t, in particular this breaks when a pointer to a variable is passed to a MIG routine. Signed-off-by: Sergey Bugaev Message-Id: <20230212111044.610942-3-bugaevc@gmail.com> --- sysdeps/mach/hurd/getcwd.c | 2 +- sysdeps/mach/hurd/readlinkat.c | 6 ++++-- sysdeps/mach/hurd/sendfile64.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'sysdeps/mach/hurd') diff --git a/sysdeps/mach/hurd/getcwd.c b/sysdeps/mach/hurd/getcwd.c index fc5e78e7d3..f24b35b380 100644 --- a/sysdeps/mach/hurd/getcwd.c +++ b/sysdeps/mach/hurd/getcwd.c @@ -117,7 +117,7 @@ __hurd_canonicalize_directory_name_internal (file_t thisdir, int mount_point; file_t newp; char *dirdata; - size_t dirdatasize; + mach_msg_type_number_t dirdatasize; int direntry, nentries; diff --git a/sysdeps/mach/hurd/readlinkat.c b/sysdeps/mach/hurd/readlinkat.c index dabdbb3713..5bb8b75371 100644 --- a/sysdeps/mach/hurd/readlinkat.c +++ b/sysdeps/mach/hurd/readlinkat.c @@ -35,6 +35,7 @@ __readlinkat (int fd, const char *file_name, char *buf, size_t len) char retryname[1024]; file_t file; char *rbuf = buf; + mach_msg_type_number_t nread = len; file_stat = __file_name_lookup_at (fd, 0, file_name, O_NOLINK, 0); if (file_stat == MACH_PORT_NULL) @@ -59,15 +60,16 @@ __readlinkat (int fd, const char *file_name, char *buf, size_t len) goto out; } - err = __io_read (file, &rbuf, &len, 0, len); + err = __io_read (file, &rbuf, &nread, 0, len); __mach_port_deallocate (__mach_task_self (), file); if (err) goto out; + len = nread; if (rbuf != buf) { memcpy (buf, rbuf, len); - __vm_deallocate (__mach_task_self (), (vm_address_t) rbuf, len); + __vm_deallocate (__mach_task_self (), (vm_address_t) rbuf, nread); } diff --git a/sysdeps/mach/hurd/sendfile64.c b/sysdeps/mach/hurd/sendfile64.c index 658b02826d..e36b979078 100644 --- a/sysdeps/mach/hurd/sendfile64.c +++ b/sysdeps/mach/hurd/sendfile64.c @@ -35,7 +35,7 @@ __sendfile64 (int out_fd, int in_fd, off64_t *offset, size_t count) which might blow if it's huge or address space is real tight. */ char *data = 0; - size_t datalen = 0; + mach_msg_type_number_t datalen = 0; error_t err = HURD_DPORT_USE (in_fd, __io_read (port, &data, &datalen, offset ? *offset : (off_t) -1, -- cgit 1.4.1