diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pppctl/pppctl.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.sbin/pppctl/pppctl.c b/usr.sbin/pppctl/pppctl.c index 918e0ec..83ee670 100644 --- a/usr.sbin/pppctl/pppctl.c +++ b/usr.sbin/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.15 1997/12/27 13:44:42 brian Exp $ + * $Id: pppctl.c,v 1.16 1998/03/22 00:43: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; } |