diff options
Diffstat (limited to 'src/libc/socket.c')
-rw-r--r-- | src/libc/socket.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libc/socket.c b/src/libc/socket.c index a8871a3..5ea7266 100644 --- a/src/libc/socket.c +++ b/src/libc/socket.c @@ -1,5 +1,6 @@ #include <arpa/inet.h> #include <camellia.h> +#include <camellia/syscalls.h> #include <errno.h> #include <netdb.h> #include <netinet/in.h> @@ -10,8 +11,12 @@ int socket(int domain, int type, int protocol) { if (domain != AF_INET || type != SOCK_STREAM || protocol != IPPROTO_TCP) { return errno = ENOSYS, -1; } - // TODO! /dev/null - return dup(1); // yolo + int h = _sys_getnull(0); + if (h < 0) { + return errno = -h, -1; + } else { + return h; + } } int bind(int, const struct sockaddr *, socklen_t) { |