-/* Copyright (C) 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993,94,95,97,2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
}
data = buf;
+ nread = *nbytes;
if (err = HURD_FD_PORT_USE (fd, _hurd_ctty_input (port, ctty, readfd)))
return err;
if (data != buf)
{
+ if (nread > *nbytes) /* Server funny business, shouldn't happen. */
+ *nbytes = nread;
memcpy (buf, data, nread);
__vm_deallocate (__mach_task_self (), (vm_address_t) data, nread);
}
-/* Copyright (C) 1991, 92, 93, 94, 95, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,97,2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
if (S_ISLNK (st.st_mode))
{
char *rbuf = buf;
+ size_t got;
- err = __io_read (file, &rbuf, &len, 0, len);
+ err = __io_read (file, &rbuf, &got, 0, len);
+ if (got < len)
+ len = got;
if (!err && 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, got);
}
}
else
-/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1994,97,2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
if (bufp != buf)
{
+ if (nread > n) /* Server funny business, shouldn't happen. */
+ nread = n;
memcpy (buf, bufp, nread);
__vm_deallocate (__mach_task_self (), (vm_address_t) bufp, nread);
}
-/* Copyright (C) 1994, 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1994,97,99,2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
__mach_port_deallocate (__mach_task_self (), addrport);
return __hurd_dfail (fd, err);
}
-
+
if (*addr_len > buflen)
*addr_len = buflen;
if (bufp != buf)
{
+ if (nread > n) /* Server funny business, shouldn't happen. */
+ nread = n;
memcpy (buf, bufp, nread);
__vm_deallocate (__mach_task_self (), (vm_address_t) bufp, nread);
}