diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h index 805fa058..f4e88e98 100644 --- a/libc/include/sys/socket.h +++ b/libc/include/sys/socket.h @@ -16,6 +16,12 @@ __BEGIN_DECLS #include typedef long socklen_t; +#if !defined(FILENAME_MAX) + #define FILENAME_MAX 256 +#elif FILENAME_MAX != 256 + #error "invalid FILENAME_MAX" +#endif + struct sockaddr { sa_family_t sa_family; /* Address family. */ @@ -24,8 +30,8 @@ struct sockaddr struct sockaddr_storage { - // FIXME sa_family_t ss_family; + char ss_storage[FILENAME_MAX]; }; struct msghdr diff --git a/libc/include/sys/un.h b/libc/include/sys/un.h index d1d538e6..7bddc493 100644 --- a/libc/include/sys/un.h +++ b/libc/include/sys/un.h @@ -11,8 +11,8 @@ __BEGIN_DECLS struct sockaddr_un { - sa_family_t sun_family; /* Address family. */ - char sun_path[]; /* Socket pathname. */ + sa_family_t sun_family; /* Address family. */ + char sun_path[FILENAME_MAX]; /* Socket pathname. */ }; __END_DECLS diff --git a/libc/sys/socket.cpp b/libc/sys/socket.cpp index 82b778a3..e9580ce4 100644 --- a/libc/sys/socket.cpp +++ b/libc/sys/socket.cpp @@ -22,7 +22,7 @@ int listen(int socket, int backlog) return syscall(SYS_LISTEN, socket, backlog); } -ssize_t revc(int socket, void* __restrict buffer, size_t length, int flags) +ssize_t recv(int socket, void* __restrict buffer, size_t length, int flags) { return recvfrom(socket, buffer, length, flags, nullptr, nullptr); }