Fix bugs in libc_noux's sendto() method

The sysio's struct fields need to be properly set on each syscall. This
fixes a bug where the wrong fd is used after the first sendto syscall.

Also the minimal buffer size calculation uses the wrong size.

Fixes #235.
This commit is contained in:
Josef Söntgen 2012-06-06 16:37:47 +02:00 committed by Norman Feske
parent c02f04da76
commit 7e3c303ad0

View File

@ -1373,7 +1373,6 @@ namespace {
return -1;
}
sysio()->sendto_in.fd = noux_fd(fd->context);
sysio()->sendto_in.addrlen = addrlen;
Genode::memcpy(&sysio()->sendto_in.dest_addr, dest_addr, addrlen);
@ -1382,8 +1381,9 @@ namespace {
char *src = (char *)buf;
while (len > 0) {
size_t curr_len = Genode::min(sizeof *sysio()->sendto_in.buf, len);
size_t curr_len = Genode::min(sizeof (sysio()->sendto_in.buf), len);
sysio()->sendto_in.fd = noux_fd(fd->context);
sysio()->sendto_in.len = curr_len;
Genode::memcpy(sysio()->sendto_in.buf, src, curr_len);