In 2.2 and 2.3, write(fd, buf, n) succeeds for all values
of 'buf' if 'fd' refers to a tty:
#include <unistd.h>
#include <errno.h>
int main()
{
unsigned long addr;
int olderrno = errno;
for (addr = 0x00000000; addr < 0xf0000000; addr += 0x08000000)
{
int ret;
ret = write(1, (void *)addr, 10);
if (ret != 10 || errno != olderrno)
{
printf("failed at 0x%x. ret=%d, errno=%d\n", addr, ret, errno);
break;
}
else
{
printf("0x%x OK\n", addr);
}
}
return 0;
}
Fix:
--- linux-2.3.99-pre6-3/drivers/char/n_tty.c Sun Apr 16 22:29:32 2000
+++ linux-akpm/drivers/char/n_tty.c Wed Apr 19 22:36:43 2000
@@ -228,7 +228,7 @@
nr = sizeof(buf);
nr -= copy_from_user(buf, inbuf, nr);
if (!nr)
- return 0;
+ return -EFAULT;
for (i = 0, cp = buf; i < nr; i++, cp++) {
switch (*cp) {
-- -akpm-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:15 EST