/* -*- C -*-
- * $Id: ocamlbotwrapper.c.in,v 1.1 2007/06/28 19:47:26 rjones Exp $
+ * $Id: ocamlbotwrapper.c.in,v 1.2 2007/06/28 20:49:10 rjones Exp $
* SUID wrapper around ocaml program.
*/
int
main ()
{
+ /* Don't worry about races here because we're just checking that
+ * the installation looks reasonable.
+ *
+ * Die if the init script does not exist. */
+ if (access ("@INITSCRIPT@", R_OK) == -1) {
+ perror ("@INITSCRIPT@");
+ exit (1);
+ }
+
+ /* Die if the ocaml program does not exist. */
+ if (access ("@OCAML@", R_OK|X_OK) == -1) {
+ perror ("@OCAML@");
+ exit (1);
+ }
+
+ /* Die if the chroot directory does not exist. */
+ if (access ("@CHROOTDIR@", R_OK|X_OK) == -1) {
+ perror ("@CHROOTDIR@");
+ exit (1);
+ }
+
/* Run the ocaml program with the correct args. */
- execle ("@OCAML@", "@OCAML@", "-init", "@INITSCRIPT@", NULL, new_environ);
+ execle ("@OCAML@", "@OCAML@",
+ "-init", "@INITSCRIPT@",
+ "-noprompt",
+ NULL, new_environ);
/* If it failed, die with an error message. */
perror ("@OCAML@");