summaryrefslogtreecommitdiff
path: root/trans/hello.c
diff options
context:
space:
mode:
Diffstat (limited to 'trans/hello.c')
-rw-r--r--trans/hello.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/trans/hello.c b/trans/hello.c
index 5c53c193..d36ba848 100644
--- a/trans/hello.c
+++ b/trans/hello.c
@@ -1,5 +1,5 @@
/* hello.c - A trivial single-file translator
- Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999,2001,02 Free Software Foundation, Inc.
Gordon Matzigkeit <gord@fig.org>, 1999
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -113,8 +113,8 @@ close_hook (struct trivfs_peropen *peropen)
error_t
trivfs_S_io_read (struct trivfs_protid *cred,
mach_port_t reply, mach_msg_type_name_t reply_type,
- vm_address_t *data, mach_msg_type_number_t *data_len,
- off_t offs, mach_msg_type_number_t amount)
+ char **data, mach_msg_type_number_t *data_len,
+ loff_t offs, mach_msg_type_number_t amount)
{
struct open *op;
@@ -139,8 +139,11 @@ trivfs_S_io_read (struct trivfs_protid *cred,
{
/* Possibly allocate a new buffer. */
if (*data_len < amount)
- *data = (vm_address_t) mmap (0, amount, PROT_READ|PROT_WRITE,
- MAP_ANON, 0, 0);
+ {
+ *data = mmap (0, amount, PROT_READ|PROT_WRITE, MAP_ANON, 0, 0);
+ if (*data == MAP_FAILED)
+ return ENOMEM;
+ }
/* Copy the constant data into the buffer. */
memcpy ((char *) *data, contents + offs, amount);