Return error when shutdown() fails (#2801)
Fix issue reported in #2787.
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
|
||||
set (PLATFORM_COMMON_POSIX_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
file (GLOB_RECURSE source_all ${PLATFORM_COMMON_POSIX_DIR}/*.c)
|
||||
@ -9,6 +9,7 @@ if (NOT WAMR_BUILD_LIBC_WASI EQUAL 1)
|
||||
list(REMOVE_ITEM source_all
|
||||
${PLATFORM_COMMON_POSIX_DIR}/posix_file.c
|
||||
${PLATFORM_COMMON_POSIX_DIR}/posix_clock.c
|
||||
${PLATFORM_COMMON_POSIX_DIR}/posix_socket.c
|
||||
)
|
||||
else()
|
||||
include (${CMAKE_CURRENT_LIST_DIR}/../libc-util/platform_common_libc_util.cmake)
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
#include "platform_api_vmcore.h"
|
||||
#include "platform_api_extension.h"
|
||||
#include "libc_errno.h"
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
@ -308,11 +309,13 @@ os_socket_close(bh_socket_t socket)
|
||||
return BHT_OK;
|
||||
}
|
||||
|
||||
int
|
||||
__wasi_errno_t
|
||||
os_socket_shutdown(bh_socket_t socket)
|
||||
{
|
||||
shutdown(socket, O_RDWR);
|
||||
return BHT_OK;
|
||||
if (shutdown(socket, O_RDWR) != 0) {
|
||||
return convert_errno(errno);
|
||||
}
|
||||
return __WASI_ESUCCESS;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user