ossp-pkg/l2/l2_sockmon.c 1.9 -> 1.10
--- l2_sockmon.c 2001/09/26 08:55:19 1.9
+++ l2_sockmon.c 2001/09/26 09:00:21 1.10
@@ -51,14 +51,14 @@
void die(const char *szMsg)
{
perror(szMsg);
- exit(1);
+ exit(EXIT_FAILURE);
}
void closedie(int iSock, const char *szMsg)
{
perror(szMsg);
close(iSock);
- exit(1);
+ exit(EXIT_FAILURE);
}
char *strlowerdup(const char *szIn)
@@ -93,7 +93,7 @@
/* EOF */
close(iSock);
fprintf(stderr, "Connection closed\n");
- return;
+ exit(EXIT_SUCCESS);
}
szBuf[cc + 1] = '\0';
@@ -143,10 +143,8 @@
iTrans = (iProtocol == IPPROTO_UDP) ? SOCK_DGRAM : SOCK_STREAM;
iSock = socket(iProtofam, iTrans, iProtocol);
- if (iSock == -1) {
- perror("socket");
- return -1;
- }
+ if (iSock == -1)
+ die("socket()");
/* Allow local addresses to be reused. */
iSockopt = 1;
@@ -282,7 +280,7 @@
if (argc != 4) {
fprintf(stderr, "Usage: %s <IPv4-or-IPv6> <TCP-or-UDP> <Port>\n", argv[0]);
- exit(1); /* Dink donk if the user doesn't know how to use this */
+ exit(EXIT_FAILURE); /* The user doesn't know how to use this */
}
iFam = (!strcmp(argv[1], "IPv6")) ? AF_INET6 : AF_INET;
|
|