summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pppctl
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-01-31 12:24:29 +0000
committerbrian <brian@FreeBSD.org>1999-01-31 12:24:29 +0000
commita1492aac3d27e320b4515c858430bdfe3a9a8ec8 (patch)
treedbea87a40a3bd67eb28884d6d45ec1e446df6fc1 /usr.sbin/pppctl
parenta807f1afc9b0f861b830bbfb2fdaa21f703e39ef (diff)
downloadFreeBSD-src-a1492aac3d27e320b4515c858430bdfe3a9a8ec8.zip
FreeBSD-src-a1492aac3d27e320b4515c858430bdfe3a9a8ec8.tar.gz
Mention the error when we fail to connect().
Diffstat (limited to 'usr.sbin/pppctl')
-rw-r--r--usr.sbin/pppctl/pppctl.c14
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;
}
OpenPOWER on IntegriCloud