From 10d5ee4bc0c1fb4b74001c45c877c9c0c74205b9 Mon Sep 17 00:00:00 2001 From: Sapan Bhatia Date: Mon, 23 Jun 2008 08:52:23 +0000 Subject: [PATCH] Tweak to try to fix KYoungSoo's problem --- directfifowatcher.ml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/directfifowatcher.ml b/directfifowatcher.ml index f3e334d..60c0987 100644 --- a/directfifowatcher.ml +++ b/directfifowatcher.ml @@ -76,7 +76,9 @@ let connect_file fqp_in = clear_nonblock fifo_fdin; let pid=try Some(create_process execpath [|execpath;slice_name|] fifo_fdin fifo_fdout fifo_fdout) with e -> None in match pid with - | Some(pid) ->Hashtbl.add pidmap pid (fqp_in,fifo_fdout) + | Some(pid) -> + if (fifo_fdout <> stdout) then close_if_open fifo_fdout; + Hashtbl.add pidmap pid (fqp_in,fifo_fdout) | None ->fprintf logfd "Error executing service: %s\n" execpath;flush logfd;reopenentry fqp_in ); ignore(sigprocmask SIG_UNBLOCK [Sys.sigchld]); @@ -122,8 +124,7 @@ let sigchld_handle s = try let fqp_in,fd_out = Hashtbl.find pidmap pid in begin - reopenentry fqp_in; - if (fd_out <> stdout) then close_if_open fd_out + reopenentry fqp_in end with _ -> () -- 2.43.0