[Pkg-ocaml-maint-commits] r1286 - in trunk/projects/approx: . debian
Eric Cooper
ecc-guest@costa.debian.org
Mon, 18 Apr 2005 00:44:33 +0000
Author: ecc-guest
Date: 2005-04-18 00:44:32 +0000 (Mon, 18 Apr 2005)
New Revision: 1286
Modified:
trunk/projects/approx/approx.ml
trunk/projects/approx/debian/changelog
Log:
daemonize correctly (closes #305102)
Modified: trunk/projects/approx/approx.ml
===================================================================
--- trunk/projects/approx/approx.ml 2005-04-17 22:26:25 UTC (rev 1285)
+++ trunk/projects/approx/approx.ml 2005-04-18 00:44:32 UTC (rev 1286)
@@ -91,7 +91,7 @@
(is_mutable name && minutes_old stats > interval)
let serve_local dir path ims ochan =
- let name = cache ^/ dir ^/ path in
+ let name = dir ^/ path in
let stats = Unix.stat name in
if debug then
begin
@@ -292,9 +292,9 @@
let serve_remote dir path ims chan =
try
- let url = map_dir dir ^/ path in
+ let local_name = dir ^/ path in
+ let url = map_dir dir ^/ path in
message "%s" url;
- let local_name = cache ^/ dir ^/ path in
let handler = method_of_url url in
handler url local_name ims chan
with e ->
@@ -331,6 +331,9 @@
| _ -> respond_forbidden ~url: req#path chan
let daemon () =
+ Unix.chdir cache;
+ ignore (Unix.setsid ());
+ List.iter Unix.close [Unix.stdin; Unix.stdout; Unix.stderr];
print_config ();
main (daemon_spec ~port ~callback ~mode: `Single ~timeout: None ())
@@ -340,10 +343,7 @@
close_out chan
let () =
- match Unix.fork () with
- | 0 ->
- (match Unix.fork () with
- | 0 -> daemon ()
- | grandchild -> write_pid_file grandchild)
- | child ->
- ignore (Unix.waitpid [] child)
+ if Unix.fork () = 0 then
+ match Unix.fork () with
+ | 0 -> daemon ()
+ | pid -> write_pid_file pid
Modified: trunk/projects/approx/debian/changelog
===================================================================
--- trunk/projects/approx/debian/changelog 2005-04-17 22:26:25 UTC (rev 1285)
+++ trunk/projects/approx/debian/changelog 2005-04-18 00:44:32 UTC (rev 1286)
@@ -1,3 +1,9 @@
+approx (1.11) unstable; urgency=low
+
+ * Daemonize correctly (closes #305102)
+
+ -- Eric Cooper <ecc@cmu.edu> Sun, 17 Apr 2005 19:57:56 -0400
+
approx (1.10) unstable; urgency=low
* Bumped dependency on syslog-ocaml (closes #305019)