Skip to content
Browse files

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.
  • Loading branch information...
1 parent c02f04d commit 7e3c303ad0ce2d1f4a2fc83d8db495e9c2e16173 @cnuke cnuke committed with nfeske Jun 6, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 ports/src/lib/libc_noux/plugin.cc
View
4 ports/src/lib/libc_noux/plugin.cc
@@ -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);

0 comments on commit 7e3c303

Please sign in to comment.
Something went wrong with that request. Please try again.