From: Ken Raeburn Date: Fri, 20 Jul 2007 03:20:36 +0000 (+0000) Subject: provide more useful error message when running kpropd on command line X-Git-Tag: krb5-1.7-alpha1~998 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=371e8e7e65c120150dd2bef4f2928302570a5531;p=krb5.git 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 --- diff --git a/src/slave/kpropd.c b/src/slave/kpropd.c index 4436ed2ab..d79005561 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) {