Skip to content

Commit

Permalink
posix_sockets: set read/write permissions for socket fd
Browse files Browse the repository at this point in the history
  • Loading branch information
miri64 committed May 24, 2019
1 parent 786b739 commit a9ae2f4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sys/posix/sockets/posix_sockets.c
Expand Up @@ -19,6 +19,7 @@
#include <assert.h>
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <string.h>

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a9ae2f4

Please sign in to comment.