aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnunet-build/packages/gnunet/gnunet/files/network.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/gnunet-build/packages/gnunet/gnunet/files/network.js b/gnunet-build/packages/gnunet/gnunet/files/network.js
index 84a9d16..011ec8f 100644
--- a/gnunet-build/packages/gnunet/gnunet/files/network.js
+++ b/gnunet-build/packages/gnunet/gnunet/files/network.js
@@ -104,8 +104,7 @@ mergeInto(LibraryManager.library, {
GNUNET_NETWORK_socket_close: function(desc) {
console.debug("socket_close(", desc, ")");
if (!(desc in SOCKETS)) {
- ___setErrNo(ERRNO_CODES.EBADF);
- return -1;
+ return 1;
}
var socket = SOCKETS[desc];
if ("port" in socket) {
@@ -155,6 +154,11 @@ mergeInto(LibraryManager.library, {
___setErrNo(ERRNO_CODES.EWOULDBLOCK);
return 0;
}
+ var len = {{{ makeGetValue('address_len', '0', 'i32') }}};
+ if (len < 110) {
+ ___setErrNo(ERRNO_CODES.EINVAL);
+ return 0;
+ }
var data = SOCKETS.incoming.shift();
var sd = NEXT_SOCKET++;
var socket = SOCKETS[sd] = {
@@ -173,6 +177,7 @@ mergeInto(LibraryManager.library, {
}
};
{{{ makeSetValue('address', '0', '1', 'i16') }}};
+ writeStringToMemory(socket.name.slice(0, 107), address + 2);
{{{ makeSetValue('address_len', '0', '110', 'i32') }}};
return sd;
},