From a9ae2f4ac932217cef8898a4513b8ce82ebc12f3 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Fri, 24 May 2019 15:58:50 +0200 Subject: [PATCH] posix_sockets: set read/write permissions for socket fd --- sys/posix/sockets/posix_sockets.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/posix/sockets/posix_sockets.c b/sys/posix/sockets/posix_sockets.c index 4b17b3904a..cb991ea405 100644 --- a/sys/posix/sockets/posix_sockets.c +++ b/sys/posix/sockets/posix_sockets.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -343,7 +344,7 @@ int socket(int domain, int type, int protocol) case AF_INET6: #endif { - int fd = vfs_bind(VFS_ANY_FD, 0, &socket_ops, s); + int fd = vfs_bind(VFS_ANY_FD, O_RDWR, &socket_ops, s); if (fd < 0) { errno = ENFILE; @@ -443,7 +444,7 @@ int accept(int socket, struct sockaddr *restrict address, sa_len); } - int fd = vfs_bind(VFS_ANY_FD, 0, &socket_ops, new_s); + int fd = vfs_bind(VFS_ANY_FD, O_RDWR, &socket_ops, new_s); if (fd < 0) { errno = ENFILE; res = -1;