git.annexia.org
/
whenjobs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use %global instead of %define in spec file (thanks Michael Scherer).
[whenjobs.git]
/
daemon
/
whenjobsd.ml
diff --git
a/daemon/whenjobsd.ml
b/daemon/whenjobsd.ml
index
3f9fe89
..
3028503
100644
(file)
--- a/
daemon/whenjobsd.ml
+++ b/
daemon/whenjobsd.ml
@@
-19,6
+19,9
@@
open Unix
open Printf
open Unix
open Printf
+(* Ensures that Whentools module is linked to the daemon. *)
+let _ = Whentools.set_variable
+
let () =
(* Running the daemon as root is a mistake. It must be run as a
* non-root user.
let () =
(* Running the daemon as root is a mistake. It must be run as a
* non-root user.
@@
-101,10
+104,13
@@
Options:
(* chdir / so we don't prevent filesystems from being unmounted. *)
chdir "/";
(* chdir / so we don't prevent filesystems from being unmounted. *)
chdir "/";
- (* Close file descriptors. *)
+ (* Close file descriptors
, replace with /dev/null
. *)
close stdin;
close stdout;
close stderr;
close stdin;
close stdout;
close stderr;
+ ignore (openfile "/dev/null" [O_RDONLY] 0);
+ ignore (openfile "/dev/null" [O_WRONLY] 0);
+ ignore (openfile "/dev/null" [O_WRONLY] 0);
(* Create a new session. *)
ignore (setsid ());
(* Create a new session. *)
ignore (setsid ());
@@
-120,11
+126,12
@@
Options:
Syslog.notice "daemon started: version=%s uid=%d home=%s"
Config.package_version euid home;
Syslog.notice "daemon started: version=%s uid=%d home=%s"
Config.package_version euid home;
- (* If there is a jobs.cmo file, load it. *)
+ (* If there is a jobs.cmo
/jobs.cmxs
file, load it. *)
let () =
let () =
- let file = sprintf "%s/jobs.cmo" jobsdir in
+ let suffix = if not Dynlink.is_native then "cmo" else "cmxs" in
+ let file = sprintf "%s/jobs.%s" jobsdir suffix in
if Sys.file_exists file then
if Sys.file_exists file then
- try Daemon.reload_file () with Failure _ -> () in
+ try Daemon.reload_file
s
() with Failure _ -> () in
(* Go into main loop. *)
Daemon.main_loop ()
(* Go into main loop. *)
Daemon.main_loop ()