From 355a7273007253dcbdb3a176d169e597ca5e43e6 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 3 Mar 2011 15:08:15 +0000 Subject: Reset the SIGPIPE signal handler immediately before executing a command. We ignore it by default so cron doesn't die if sendmail is missing or exits prematurely but the actual command being run should have the default handler installed. --- usr.sbin/cron/atrun.c | 4 +++- usr.sbin/cron/do_command.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/cron/atrun.c b/usr.sbin/cron/atrun.c index bace65599f2..dca90304217 100644 --- a/usr.sbin/cron/atrun.c +++ b/usr.sbin/cron/atrun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atrun.c,v 1.16 2009/10/27 23:59:51 deraadt Exp $ */ +/* $OpenBSD: atrun.c,v 1.17 2011/03/03 15:08:14 millert Exp $ */ /* * Copyright (c) 2002-2003 Todd C. Miller @@ -489,6 +489,8 @@ run_job(atjob *job, char *atfile) } #endif /*DEBUGGING*/ + (void) signal(SIGPIPE, SIG_DFL); + /* * Exec /bin/sh with stdin connected to the at job file * and stdout/stderr hooked up to our parent. diff --git a/usr.sbin/cron/do_command.c b/usr.sbin/cron/do_command.c index f6f3e97c3da..b272e5ccc6b 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.34 2010/12/14 23:32:06 millert Exp $ */ +/* $OpenBSD: do_command.c,v 1.35 2011/03/03 15:08:14 millert Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved @@ -247,6 +247,8 @@ child_process(entry *e, user *u) { #endif /* LOGIN_CAP */ chdir(env_get("HOME", e->envp)); + (void) signal(SIGPIPE, SIG_DFL); + /* * Exec the command. */ -- cgit v1.2.3