diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-06-04 05:21:49 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-06-04 05:21:49 +0000 |
commit | cd0b687b94011ab750c74fa6e6c5afe36bf80230 (patch) | |
tree | 5e7c0d19b1624086ce665e757eebb83f242d837c /nc.c | |
parent | 704f1c3610edaf4e0cd0ef1a3ed46bc45b966a56 (diff) | |
download | busybox-w32-cd0b687b94011ab750c74fa6e6c5afe36bf80230.tar.gz busybox-w32-cd0b687b94011ab750c74fa6e6c5afe36bf80230.tar.bz2 busybox-w32-cd0b687b94011ab750c74fa6e6c5afe36bf80230.zip |
"nc" exits silently on errors. This patch makes it print something before
exit().
Note that calling perror() after gethostbyname() will most likely return
"No such file or directory" which is quite confusing, so I decided to use
fatalError instead.
Regards,
Pavel Roskin
git-svn-id: svn://busybox.net/trunk/busybox@607 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'nc.c')
-rw-r--r-- | nc.c | 4 |
1 files changed, 3 insertions, 1 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 | ||