aboutsummaryrefslogtreecommitdiff
path: root/src/slave
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2007-07-20 03:20:36 +0000
committerKen Raeburn <raeburn@mit.edu>2007-07-20 03:20:36 +0000
commit371e8e7e65c120150dd2bef4f2928302570a5531 (patch)
treee19b05b0323f215d0211ad0d5af83966ba3fb98f /src/slave
parentc7f2957ec351c161b999c3bdfb654bc8a84556e1 (diff)
downloadkrb5-371e8e7e65c120150dd2bef4f2928302570a5531.zip
krb5-371e8e7e65c120150dd2bef4f2928302570a5531.tar.gz
krb5-371e8e7e65c120150dd2bef4f2928302570a5531.tar.bz2
provide more useful error message when running kpropd on command line
The way kpropd indicates that it's supposed to be connected to the network is by printing out a socket error: kpropd: getpeername: Socket operation on non-socket With this patch, it's a bit more friendly: ./kpropd: Standard input does not appear to be a network socket. (Not run from inetd, and missing the -S option?) ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19720 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/slave')
-rw-r--r--src/slave/kpropd.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/slave/kpropd.c b/src/slave/kpropd.c
index 4436ed2..d790055 100644
--- a/src/slave/kpropd.c
+++ b/src/slave/kpropd.c
@@ -27,7 +27,7 @@
/*
* slave/kpropd.c
*
- * Copyright 1990,1991 by the Massachusetts Institute of Technology.
+ * Copyright 1990,1991,2007 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
@@ -282,9 +282,18 @@ void doit(fd)
fromlen = sizeof (from);
if (getpeername(fd, (struct sockaddr *) &from, &fromlen) < 0) {
- fprintf(stderr, "%s: ", progname);
- perror("getpeername");
+#ifdef ENOTSOCK
+ if (errno == ENOTSOCK && fd == 0 && !standalone) {
+ fprintf(stderr,
+ "%s: Standard input does not appear to be a network socket.\n"
+ "\t(Not run from inetd, and missing the -S option?)\n",
+ progname);
exit(1);
+ }
+#endif
+ fprintf(stderr, "%s: ", progname);
+ perror("getpeername");
+ exit(1);
}
if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (caddr_t) &on,
sizeof (on)) < 0) {