summaryrefslogtreecommitdiffstats
path: root/usr.sbin/cron/do_command.c
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2015-01-23 01:01:06 +0000
committertedu <tedu@openbsd.org>2015-01-23 01:01:06 +0000
commit585d9be6bb6d448e46612ddbbf011e7472b45079 (patch)
tree5d724bb60543ad8641dd35f2dc6cb21de476de42 /usr.sbin/cron/do_command.c
parentWonders of roff(7): Integer numbers in numerical expressions can carry (diff)
downloadwireguard-openbsd-585d9be6bb6d448e46612ddbbf011e7472b45079.tar.xz
wireguard-openbsd-585d9be6bb6d448e46612ddbbf011e7472b45079.zip
remove debug code.
I think the level of debug code in cron is excessive for a program that has reached feature complete. If cron needs to provide more information to the user about its operational status, I think syslog would be more appropriate. (The debug flags also disable forking into the background, so they aren't even that useful for debugging a live system.) ok deraadt millert
Diffstat (limited to 'usr.sbin/cron/do_command.c')
-rw-r--r--usr.sbin/cron/do_command.c53
1 files changed, 4 insertions, 49 deletions
diff --git a/usr.sbin/cron/do_command.c b/usr.sbin/cron/do_command.c
index 970276e8915..6e774f2e66f 100644
--- a/usr.sbin/cron/do_command.c
+++ b/usr.sbin/cron/do_command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: do_command.c,v 1.41 2015/01/14 17:30:53 millert Exp $ */
+/* $OpenBSD: do_command.c,v 1.42 2015/01/23 01:01:06 tedu Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* All rights reserved
@@ -27,9 +27,6 @@ static void child_process(entry *, user *);
void
do_command(entry *e, user *u) {
- Debug(DPROC, ("[%ld] do_command(%s, (%s,%lu,%lu))\n",
- (long)getpid(), e->cmd, u->name,
- (u_long)e->pwd->pw_uid, (u_long)e->pwd->pw_gid))
/* fork to become asynchronous -- parent process is done immediately,
* and continues to run the normal cron code, which means return to
@@ -46,15 +43,12 @@ do_command(entry *e, user *u) {
/* child process */
acquire_daemonlock(1);
child_process(e, u);
- Debug(DPROC, ("[%ld] child process done, exiting\n",
- (long)getpid()))
_exit(EXIT_SUCCESS);
break;
default:
/* parent process */
break;
}
- Debug(DPROC, ("[%ld] main process returning to work\n",(long)getpid()))
}
static void
@@ -64,8 +58,6 @@ child_process(entry *e, user *u) {
char *input_data, *usernm;
int children = 0;
- Debug(DPROC, ("[%ld] child_process('%s')\n", (long)getpid(), e->cmd))
-
/* mark ourselves as different to PS command watchers */
setproctitle("running job");
@@ -130,9 +122,6 @@ child_process(entry *e, user *u) {
_exit(EXIT_FAILURE);
/*NOTREACHED*/
case 0:
- Debug(DPROC, ("[%ld] grandchild process fork()'ed\n",
- (long)getpid()))
-
/* write a log message. we've waited this long to do it
* because it was not until now that we knew the PID that
* the actual user command shell was going to get and the
@@ -255,15 +244,6 @@ child_process(entry *e, user *u) {
{
char *shell = env_get("SHELL", e->envp);
-# if DEBUGGING
- if (DebugFlags & DTEST) {
- fprintf(stderr,
- "debug DTEST is on, not exec'ing command.\n");
- fprintf(stderr,
- "\tcmd='%s' shell='%s'\n", e->cmd, shell);
- _exit(EXIT_SUCCESS);
- }
-# endif /*DEBUGGING*/
execle(shell, shell, "-c", e->cmd, (char *)NULL, e->envp);
fprintf(stderr, "execle: couldn't exec `%s'\n", shell);
perror("execle");
@@ -281,8 +261,6 @@ child_process(entry *e, user *u) {
* the user's command.
*/
- Debug(DPROC, ("[%ld] child continues, closing pipes\n",(long)getpid()))
-
/* close the ends of the pipe that will only be referenced in the
* grandchild process...
*/
@@ -306,9 +284,6 @@ child_process(entry *e, user *u) {
int escaped = FALSE;
int ch;
- Debug(DPROC, ("[%ld] child2 sending data to grandchild\n",
- (long)getpid()))
-
/* close the pipe we don't use, since we inherited it and
* are part of its reference count now.
*/
@@ -343,8 +318,6 @@ child_process(entry *e, user *u) {
*/
fclose(out);
- Debug(DPROC, ("[%ld] child2 done sending to grandchild\n",
- (long)getpid()))
_exit(EXIT_SUCCESS);
}
@@ -362,9 +335,6 @@ child_process(entry *e, user *u) {
* when the grandchild exits, we'll get EOF.
*/
- Debug(DPROC, ("[%ld] child reading output from grandchild\n",
- (long)getpid()))
-
(void) signal(SIGPIPE, SIG_IGN);
in = fdopen(stdout_pipe[READ_PIPE], "r");
if (in != NULL) {
@@ -376,10 +346,6 @@ child_process(entry *e, user *u) {
int bytes = 1;
int status = 0;
- Debug(DPROC|DEXT,
- ("[%ld] got data (%x:%c) from grandchild\n",
- (long)getpid(), ch, ch))
-
/* get name of recipient. this is MAILTO if set to a
* valid local username; USER otherwise.
*/
@@ -448,8 +414,6 @@ child_process(entry *e, user *u) {
*/
if (mail) {
- Debug(DPROC, ("[%ld] closing pipe to mail\n",
- (long)getpid()))
/* Note: the pclose will probably see
* the termination of the grandchild
* in addition to the mail process, since
@@ -475,9 +439,6 @@ child_process(entry *e, user *u) {
} /*if data from grandchild*/
- Debug(DPROC, ("[%ld] got EOF from grandchild\n",
- (long)getpid()))
-
fclose(in); /* also closes stdout_pipe[READ_PIPE] */
}
@@ -487,21 +448,15 @@ child_process(entry *e, user *u) {
int waiter;
pid_t pid;
- Debug(DPROC, ("[%ld] waiting for grandchild #%d to finish\n",
- (long)getpid(), children))
while ((pid = wait(&waiter)) < OK && errno == EINTR)
;
if (pid < OK) {
- Debug(DPROC,
- ("[%ld] no more grandchildren--mail written?\n",
- (long)getpid()))
break;
}
- Debug(DPROC, ("[%ld] grandchild #%ld finished, status=%04x",
- (long)getpid(), (long)pid, WEXITSTATUS(waiter)))
- if (WIFSIGNALED(waiter) && WCOREDUMP(waiter))
+ /*
+ * if (WIFSIGNALED(waiter) && WCOREDUMP(waiter))
Debug(DPROC, (", dumped core"))
- Debug(DPROC, ("\n"))
+ */
}
}