Replaced negative exit codes with positive ones or 'errno'

Aadhavan Srinivasan 2 years ago
parent cf4db500c1
commit 74c5025370

@ -44,7 +44,7 @@ void create_addr(int network, char* address, int port,struct sockaddr* dest) {
return;
} else {
exit(-2);
exit(2);
}
}
@ -52,7 +52,7 @@ void create_addr(int network, char* address, int port,struct sockaddr* dest) {
int create_local (int network, char transport, char* address, int port,struct sockaddr* addr_struct) {
int socket = create_socket(network,transport);
if (socket < 0) {
exit(socket);
exit(errno);
}
create_addr(network,address,port,addr_struct);
int addrlen;
@ -61,7 +61,7 @@ int create_local (int network, char transport, char* address, int port,struct so
} else if (network == 6) {
addrlen = sizeof(struct sockaddr_in6);
} else {
exit(-7);
exit(7);
}
/* The value of addrlen should be the size of the 'sockaddr'.
@ -80,7 +80,7 @@ int create_remote (int network,char transport,char* address,int port,struct sock
int socket = create_socket(network,transport);
if (socket < 0) {
exit(socket);
exit(errno);
}
create_addr(network,address,port,remote_addr_struct);
int addrlen;
@ -89,7 +89,7 @@ int create_remote (int network,char transport,char* address,int port,struct sock
} else if (network == 6) {
addrlen = sizeof(struct sockaddr_in6);
} else {
exit(-7);
exit(7);
}
/* The value of addrlen should be the size of the 'sockaddr'.

Loading…
Cancel
Save