diff options
-rw-r--r-- | nc.c | 4 | ||||
-rw-r--r-- | networking/nc.c | 4 |
2 files changed, 6 insertions, 2 deletions
@@ -69,7 +69,7 @@ int nc_main(int argc, char **argv) | |||
69 | hostinfo = (struct hostent *) gethostbyname(*argv); | 69 | hostinfo = (struct hostent *) gethostbyname(*argv); |
70 | 70 | ||
71 | if (!hostinfo) { | 71 | if (!hostinfo) { |
72 | exit(1); | 72 | fatalError("nc: cannot resolve %s\n", *argv); |
73 | } | 73 | } |
74 | 74 | ||
75 | address.sin_family = AF_INET; | 75 | address.sin_family = AF_INET; |
@@ -81,6 +81,7 @@ int nc_main(int argc, char **argv) | |||
81 | result = connect(sfd, (struct sockaddr *) &address, len); | 81 | result = connect(sfd, (struct sockaddr *) &address, len); |
82 | 82 | ||
83 | if (result < 0) { | 83 | if (result < 0) { |
84 | perror("nc: connect"); | ||
84 | exit(2); | 85 | exit(2); |
85 | } | 86 | } |
86 | 87 | ||
@@ -100,6 +101,7 @@ int nc_main(int argc, char **argv) | |||
100 | (struct timeval *) 0); | 101 | (struct timeval *) 0); |
101 | 102 | ||
102 | if (result < 1) { | 103 | if (result < 1) { |
104 | perror("nc: select"); | ||
103 | exit(3); | 105 | exit(3); |
104 | } | 106 | } |
105 | 107 | ||
diff --git a/networking/nc.c b/networking/nc.c index a588587fb..a7e48d39b 100644 --- a/networking/nc.c +++ b/networking/nc.c | |||
@@ -69,7 +69,7 @@ int nc_main(int argc, char **argv) | |||
69 | hostinfo = (struct hostent *) gethostbyname(*argv); | 69 | hostinfo = (struct hostent *) gethostbyname(*argv); |
70 | 70 | ||
71 | if (!hostinfo) { | 71 | if (!hostinfo) { |
72 | exit(1); | 72 | fatalError("nc: cannot resolve %s\n", *argv); |
73 | } | 73 | } |
74 | 74 | ||
75 | address.sin_family = AF_INET; | 75 | address.sin_family = AF_INET; |
@@ -81,6 +81,7 @@ int nc_main(int argc, char **argv) | |||
81 | result = connect(sfd, (struct sockaddr *) &address, len); | 81 | result = connect(sfd, (struct sockaddr *) &address, len); |
82 | 82 | ||
83 | if (result < 0) { | 83 | if (result < 0) { |
84 | perror("nc: connect"); | ||
84 | exit(2); | 85 | exit(2); |
85 | } | 86 | } |
86 | 87 | ||
@@ -100,6 +101,7 @@ int nc_main(int argc, char **argv) | |||
100 | (struct timeval *) 0); | 101 | (struct timeval *) 0); |
101 | 102 | ||
102 | if (result < 1) { | 103 | if (result < 1) { |
104 | perror("nc: select"); | ||
103 | exit(3); | 105 | exit(3); |
104 | } | 106 | } |
105 | 107 | ||