diff options
author | brian <brian@cvs.openbsd.org> | 1999-01-31 12:25:05 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 1999-01-31 12:25:05 +0000 |
commit | fd89b8127a42f7f1e8364d5b93d3f95a23fe1f59 (patch) | |
tree | 39939e38b6dd12a95e364a0ae308cda17f75cd2a /usr.sbin/ppp | |
parent | 4e5af9222c897cf1240217d5e87e501d7cc2c13f (diff) |
Mention the error when we fail to connect().
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r-- | usr.sbin/ppp/pppctl/pppctl.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.sbin/ppp/pppctl/pppctl.c b/usr.sbin/ppp/pppctl/pppctl.c index e59374c591b..d903ffb76fd 100644 --- a/usr.sbin/ppp/pppctl/pppctl.c +++ b/usr.sbin/ppp/pppctl/pppctl.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: pppctl.c,v 1.1 1998/08/31 00:22:31 brian Exp $ + * $Id: pppctl.c,v 1.2 1999/01/31 12:25:04 brian Exp $ */ #include <sys/types.h> @@ -198,7 +198,7 @@ main(int argc, char **argv) struct sockaddr *sock; struct sockaddr_in ifsin; struct sockaddr_un ifsun; - int socksz, arg, fd, len, verbose; + int socksz, arg, fd, len, verbose, err; unsigned TimeoutVal; char *DoneWord = "x", *next, *start; struct sigaction act, oact; @@ -314,13 +314,19 @@ main(int argc, char **argv) } if (connect(fd, sock, socksz) < 0) { + err = errno; if (TimeoutVal) { alarm(0); sigaction(SIGALRM, &oact, 0); } - if (TimedOut) + if (TimedOut) { fputs("Timeout: ", stderr); - fprintf(stderr, "Cannot connect to socket %s\n", argv[arg]); + err = 0; + } + fprintf(stderr, "Cannot connect to socket %s", argv[arg]); + if (err) + fprintf(stderr, ": %s", strerror(err)); + fputc('\n', stderr); close(fd); return 3; } |