Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178320949
D29566.1796492636.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D29566.1796492636.diff
View Options
Index: usr.sbin/lpr/lpd/lpd.8
===================================================================
--- usr.sbin/lpr/lpd/lpd.8
+++ usr.sbin/lpr/lpd/lpd.8
@@ -108,6 +108,17 @@
will not accept any connections from any remote
hosts, although it will still accept print requests
from all local users.
+.It Fl F
+By default,
+.Nm
+will daemonize into the background.
+The
+.Fl F
+flag causes
+.Nm
+to remain in the foreground.
+Logging is still performed with
+.Xr syslog 3 .
.It Fl W
By default, the
.Nm
Index: usr.sbin/lpr/lpd/lpd.c
===================================================================
--- usr.sbin/lpr/lpd/lpd.c
+++ usr.sbin/lpr/lpd/lpd.c
@@ -104,6 +104,7 @@
int lflag; /* log requests flag */
int sflag; /* no incoming port flag */
+int Fflag; /* run in foreground flag */
int from_remote; /* from remote socket */
int main(int argc, char **_argv);
@@ -152,7 +153,7 @@
errx(EX_NOPERM,"must run as root");
errs = 0;
- while ((i = getopt(argc, argv, "cdlpswW46")) != -1)
+ while ((i = getopt(argc, argv, "cdlpswFW46")) != -1)
switch (i) {
case 'c':
/* log all kinds of connection-errors to syslog */
@@ -184,6 +185,9 @@
syslog(LOG_WARNING,
"NOTE: please change your lpd config to use -W");
/* FALLTHROUGH */
+ case 'F':
+ Fflag++;
+ break;
case 'W':
/* allow connections coming from a non-reserved port */
/* (done by some lpr-implementations for MS-Windows) */
@@ -264,12 +268,16 @@
WEXITSTATUS(status));
}
-#ifndef DEBUG
+#ifdef DEBUG
+ Fflag++;
+#endif
/*
- * Set up standard environment by detaching from the parent.
+ * Set up standard environment by detaching from the parent
+ * if -F not specified
*/
- daemon(0, 0);
-#endif
+ if (Fflag == 0) {
+ daemon(0, 0);
+ }
openlog("lpd", LOG_PID, LOG_LPR);
syslog(LOG_INFO, "lpd startup: logging=%d%s%s", lflag,
@@ -932,9 +940,9 @@
usage(void)
{
#ifdef INET6
- fprintf(stderr, "usage: lpd [-cdlsW46] [port#]\n");
+ fprintf(stderr, "usage: lpd [-cdlsFW46] [port#]\n");
#else
- fprintf(stderr, "usage: lpd [-cdlsW] [port#]\n");
+ fprintf(stderr, "usage: lpd [-cdlsFW] [port#]\n");
#endif
exit(EX_USAGE);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 5, 5:43 PM (17 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42236701
Default Alt Text
D29566.1796492636.diff (2 KB)
Attached To
Mode
D29566: lpd: Add -F flag to prevent daemonizing
Attached
Detach File
Event Timeline