Made socket() accept an udp or tcp protocol number

This commit is contained in:
Ben Gras 2005-09-01 15:24:29 +00:00
parent f67ccc7333
commit 9bc5da4276

View File

@ -5,6 +5,7 @@
#include <sys/socket.h>
#include <net/netlib.h>
#include <netinet/in.h>
#define DEBUG 0
@ -42,7 +43,7 @@ int socket(int domain, int type, int protocol)
static int _tcp_socket(int protocol)
{
int fd;
if (protocol != 0)
if (protocol != 0 && protocol != IPPROTO_TCP)
{
#if DEBUG
fprintf(stderr, "socket(tcp): bad protocol %d\n", protocol);
@ -58,7 +59,7 @@ static int _udp_socket(int protocol)
{
int fd;
if (protocol != 0)
if (protocol != 0 && protocol != IPPROTO_UDP)
{
#if DEBUG
fprintf(stderr, "socket(udp): bad protocol %d\n", protocol);