hooks.c (213429) | hooks.c (213938) |
---|---|
1/*- 2 * Copyright (c) 2010 The FreeBSD Foundation 3 * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org> 4 * All rights reserved. 5 * 6 * This software was developed by Pawel Jakub Dawidek under sponsorship from 7 * the FreeBSD Foundation. 8 * --- 15 unchanged lines hidden (view full) --- 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2010 The FreeBSD Foundation 3 * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org> 4 * All rights reserved. 5 * 6 * This software was developed by Pawel Jakub Dawidek under sponsorship from 7 * the FreeBSD Foundation. 8 * --- 15 unchanged lines hidden (view full) --- 24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sbin/hastd/hooks.c 213429 2010-10-04 21:43:06Z pjd $"); | 32__FBSDID("$FreeBSD: head/sbin/hastd/hooks.c 213938 2010-10-16 22:48:48Z pjd $"); |
33 34#include <sys/types.h> 35#include <sys/sysctl.h> 36#include <sys/wait.h> 37 38#include <assert.h> 39#include <errno.h> 40#include <fcntl.h> --- 308 unchanged lines hidden (view full) --- 349} 350 351void 352hook_execv(const char *path, va_list ap) 353{ 354 struct hookproc *hp; 355 char *args[64]; 356 unsigned int ii; | 33 34#include <sys/types.h> 35#include <sys/sysctl.h> 36#include <sys/wait.h> 37 38#include <assert.h> 39#include <errno.h> 40#include <fcntl.h> --- 308 unchanged lines hidden (view full) --- 349} 350 351void 352hook_execv(const char *path, va_list ap) 353{ 354 struct hookproc *hp; 355 char *args[64]; 356 unsigned int ii; |
357 sigset_t mask; |
|
357 pid_t pid; 358 359 assert(hooks_initialized); 360 361 if (path == NULL || path[0] == '\0') 362 return; 363 364 memset(args, 0, sizeof(args)); --- 12 unchanged lines hidden (view full) --- 377 pid = fork(); 378 switch (pid) { 379 case -1: /* Error. */ 380 pjdlog_errno(LOG_ERR, "Unable to fork to execute %s", path); 381 hook_free(hp); 382 return; 383 case 0: /* Child. */ 384 descriptors(); | 358 pid_t pid; 359 360 assert(hooks_initialized); 361 362 if (path == NULL || path[0] == '\0') 363 return; 364 365 memset(args, 0, sizeof(args)); --- 12 unchanged lines hidden (view full) --- 378 pid = fork(); 379 switch (pid) { 380 case -1: /* Error. */ 381 pjdlog_errno(LOG_ERR, "Unable to fork to execute %s", path); 382 hook_free(hp); 383 return; 384 case 0: /* Child. */ 385 descriptors(); |
386 PJDLOG_VERIFY(sigemptyset(&mask) == 0); 387 PJDLOG_VERIFY(sigprocmask(SIG_SETMASK, &mask, NULL) == 0); |
|
385 execv(path, args); 386 pjdlog_errno(LOG_ERR, "Unable to execute %s", path); 387 exit(EX_SOFTWARE); 388 default: /* Parent. */ 389 hook_add(hp, pid); 390 break; 391 } 392} | 388 execv(path, args); 389 pjdlog_errno(LOG_ERR, "Unable to execute %s", path); 390 exit(EX_SOFTWARE); 391 default: /* Parent. */ 392 hook_add(hp, pid); 393 break; 394 } 395} |