2 * $Id: ocamlbotwrapper.c,v 1.2 2007/06/28 20:49:10 rjones Exp $
3 * SUID wrapper around ocaml program.
11 const char *new_environ[] = {
19 /* Don't worry about races here because we're just checking that
20 * the installation looks reasonable.
22 * Die if the init script does not exist. */
23 if (access ("init", R_OK) == -1) {
28 /* Die if the ocaml program does not exist. */
29 if (access ("/usr/bin/ocaml", R_OK|X_OK) == -1) {
30 perror ("/usr/bin/ocaml");
34 /* Die if the chroot directory does not exist. */
35 if (access ("/var/local/xavierbot/chroot", R_OK|X_OK) == -1) {
36 perror ("/var/local/xavierbot/chroot");
40 /* Run the ocaml program with the correct args. */
41 execle ("/usr/bin/ocaml", "@OCAML@",
46 /* If it failed, die with an error message. */
47 perror ("/usr/bin/ocaml");