summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nc.c4
-rw-r--r--networking/nc.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/nc.c b/nc.c
index a588587..a7e48d3 100644
--- a/nc.c
+++ b/nc.c
@@ -69,7 +69,7 @@ int nc_main(int argc, char **argv)
hostinfo = (struct hostent *) gethostbyname(*argv);
if (!hostinfo) {
- exit(1);
+ fatalError("nc: cannot resolve %s\n", *argv);
}
address.sin_family = AF_INET;
@@ -81,6 +81,7 @@ int nc_main(int argc, char **argv)
result = connect(sfd, (struct sockaddr *) &address, len);
if (result < 0) {
+ perror("nc: connect");
exit(2);
}
@@ -100,6 +101,7 @@ int nc_main(int argc, char **argv)
(struct timeval *) 0);
if (result < 1) {
+ perror("nc: select");
exit(3);
}
diff --git a/networking/nc.c b/networking/nc.c
index a588587..a7e48d3 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -69,7 +69,7 @@ int nc_main(int argc, char **argv)
hostinfo = (struct hostent *) gethostbyname(*argv);
if (!hostinfo) {
- exit(1);
+ fatalError("nc: cannot resolve %s\n", *argv);
}
address.sin_family = AF_INET;
@@ -81,6 +81,7 @@ int nc_main(int argc, char **argv)
result = connect(sfd, (struct sockaddr *) &address, len);
if (result < 0) {
+ perror("nc: connect");
exit(2);
}
@@ -100,6 +101,7 @@ int nc_main(int argc, char **argv)
(struct timeval *) 0);
if (result < 1) {
+ perror("nc: select");
exit(3);
}