Improve the error message the user sees if the startdaemon routine cannot

connect() to the socket for lpd.  Tell them this error probably means that
the master 'lpd' process is not running.

MFC after:	4 days
This commit is contained in:
Garance A Drosehn 2002-04-23 02:42:04 +00:00
parent 7a0776e477
commit 055c131503
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=95299

View File

@ -64,6 +64,7 @@ startdaemon(const struct printer *pp)
{
struct sockaddr_un un;
register int s, n;
int connectres;
char c;
s = socket(PF_LOCAL, SOCK_STREAM, 0);
@ -78,13 +79,14 @@ startdaemon(const struct printer *pp)
#define SUN_LEN(unp) (strlen((unp)->sun_path) + 2)
#endif
seteuid(euid);
if (connect(s, (struct sockaddr *)&un, SUN_LEN(&un)) < 0) {
seteuid(uid);
warn("connect");
connectres = connect(s, (struct sockaddr *)&un, SUN_LEN(&un));
seteuid(uid);
if (connectres < 0) {
warn("Unable to connect to %s", _PATH_SOCKETNAME);
warnx("Check to see if the master 'lpd' process is running.");
(void) close(s);
return(0);
}
seteuid(uid);
/*
* Avoid overruns without putting artificial limitations on