Skip to content

Commit 7c68c42

Browse files
committed
Fixes from review
1 parent 07df379 commit 7c68c42

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

src/crl.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,11 @@ static THREAD_RETURN WOLFSSL_THREAD DoMonitor(void* arg)
17161716
return NULL;
17171717
}
17181718
#ifdef FD_CLOEXEC
1719-
(void)fcntl(crl->mfd, F_SETFD, FD_CLOEXEC);
1719+
{
1720+
int fdFlags = fcntl(crl->mfd, F_GETFD);
1721+
if (fdFlags >= 0)
1722+
(void)fcntl(crl->mfd, F_SETFD, fdFlags | FD_CLOEXEC);
1723+
}
17201724
#endif
17211725

17221726
/* listen for custom shutdown event */

src/wolfio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@ int wolfIO_TcpAccept(SOCKET_T sockfd, SOCKADDR* peer_addr, XSOCKLENT* peer_len)
16401640
{
16411641
int fd;
16421642
#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_ZEPHYR) && \
1643-
defined(SOCK_CLOEXEC) && (defined(__linux__) || defined(__ANDROID__))
1643+
(defined(__linux__) || defined(__ANDROID__))
16441644
fd = (int)accept4(sockfd, peer_addr, peer_len, SOCK_CLOEXEC);
16451645
#else
16461646
fd = (int)accept(sockfd, peer_addr, peer_len);

wolfcrypt/src/port/af_alg/afalg_hash.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
2020
*/
2121

22+
#if defined(__linux__) && !defined(_GNU_SOURCE)
23+
#define _GNU_SOURCE 1
24+
#endif
25+
2226
#include <wolfssl/wolfcrypt/libwolfssl_sources.h>
2327

2428
#if defined(WOLFSSL_AFALG_HASH) || (defined(WOLFSSL_AFALG_XILINX_SHA3) \

wolfcrypt/src/port/af_alg/wc_afalg.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
2020
*/
2121

22+
#if defined(__linux__) && !defined(_GNU_SOURCE)
23+
#define _GNU_SOURCE 1
24+
#endif
25+
2226
#include <wolfssl/wolfcrypt/libwolfssl_sources.h>
2327

2428
#if defined(WOLFSSL_AFALG) || defined(WOLFSSL_AFALG_XILINX)
@@ -61,7 +65,7 @@ int wc_Afalg_Accept(struct sockaddr_alg* in, int inSz, int sock)
6165
return WC_AFALG_SOCK_E;
6266
}
6367

64-
#if defined(__linux__) && defined(SOCK_CLOEXEC)
68+
#if defined(__linux__)
6569
return accept4(sock, NULL, NULL, SOCK_CLOEXEC);
6670
#else
6771
return accept(sock, NULL, NULL);

0 commit comments

Comments
 (0)