/*
* A Simple Testing Sandbox
*
- * (c) 2001 Martin Mares <mj@ucw.cz>
+ * (c) 2001--2004 Martin Mares <mj@ucw.cz>
*/
#define _LARGEFILE64_SOURCE
return (filter_syscalls == 1);
case SYS_times:
return allow_times;
+ case SYS_kill:
+ if (u->regs.ebx == box_pid)
+ die("Commited suicide by signal %d.", (int)u->regs.ecx);
+ return 0;
default:
return 0;
}
memcpy(args, argv, argc * sizeof(char *));
args[argc] = NULL;
+ if (set_cwd && chdir(set_cwd))
+ die("chdir: %m");
if (redir_stdin)
{
close(0);
if (open(redir_stdout, O_WRONLY | O_CREAT | O_TRUNC, 0666) != 1)
die("open(\"%s\"): %m", redir_stdout);
}
- if (set_cwd && chdir(set_cwd))
- die("chdir: %m");
dup2(1, 2);
setpgrp();
if (memory_limit)