Return error when shutdown() fails (#2801)

Fix issue reported in #2787.
This commit is contained in:
Marcin Kolny
2023-11-24 13:03:59 +00:00
committed by GitHub
parent 1ba4acd1c7
commit 5f7079f0f5
10 changed files with 88 additions and 66 deletions

View File

@ -5,6 +5,7 @@
#include "platform_api_vmcore.h"
#include "platform_api_extension.h"
#include "libc_errno.h"
#ifndef SGX_DISABLE_WASI
@ -855,10 +856,13 @@ os_socket_send_to(bh_socket_t socket, const void *buf, unsigned int len,
return ret;
}
int
__wasi_errno_t
os_socket_shutdown(bh_socket_t socket)
{
return shutdown(socket, O_RDWR);
if (shutdown(socket, O_RDWR) != 0) {
return convert_errno(errno);
}
return __WASI_ESUCCESS;
}
int