summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr/common_source/startdaemon.c
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2002-04-23 02:42:04 +0000
committergad <gad@FreeBSD.org>2002-04-23 02:42:04 +0000
commitccf61115c4dedb35a7931b0d4d8846a8dfb5c4e5 (patch)
tree8f1afb1a2539c805bdd9828ca4bf8052bae289d8 /usr.sbin/lpr/common_source/startdaemon.c
parent780f32f69392793930eb9f59f7b0cc0e10ad9c22 (diff)
downloadFreeBSD-src-ccf61115c4dedb35a7931b0d4d8846a8dfb5c4e5.zip
FreeBSD-src-ccf61115c4dedb35a7931b0d4d8846a8dfb5c4e5.tar.gz
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
Diffstat (limited to 'usr.sbin/lpr/common_source/startdaemon.c')
-rw-r--r--usr.sbin/lpr/common_source/startdaemon.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/lpr/common_source/startdaemon.c b/usr.sbin/lpr/common_source/startdaemon.c
index c9c978e..16ec7ce 100644
--- a/usr.sbin/lpr/common_source/startdaemon.c
+++ b/usr.sbin/lpr/common_source/startdaemon.c
@@ -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
OpenPOWER on IntegriCloud