daemon: On fork, open stdin/stdout/stderr on /dev/null.
[whenjobs.git] / daemon / daemon.ml
index 6c3799c..542c7a4 100644 (file)
@@ -94,23 +94,7 @@ and proc_set_variable (name, value) =
   if !debug then Syslog.notice "remote call: set_variable %s" name;
 
   try
-    (* Don't permit certain names. *)
-    if name = "JOBSERIAL" then
-      failwith "JOBSERIAL variable cannot be set";
-
-    let len = String.length name in
-    if len = 0 then
-      failwith "variable name is an empty string";
-    if name.[0] <> '_' && not (isalpha name.[0]) then
-      failwith "variable name must start with alphabetic character or underscore";
-
-    let rec loop i =
-      if i >= len then ()
-      else if name.[i] <> '_' && not (isalnum name.[i]) then
-        failwith "variable name contains non-alphanumeric non-underscore character"
-      else loop (i+1)
-    in
-    loop 1;
+    check_valid_variable_name name;
 
     let value = variable_of_rpc value in
     state := Whenstate.set_variable !state name value;