From: Sapan Bhatia Date: Mon, 23 Jun 2008 08:52:23 +0000 (+0000) Subject: Tweak to try to fix KYoungSoo's problem X-Git-Tag: vsys-0.7-14~2 X-Git-Url: http://git.onelab.eu/?p=vsys.git;a=commitdiff_plain;h=10d5ee4bc0c1fb4b74001c45c877c9c0c74205b9 Tweak to try to fix KYoungSoo's problem --- 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 _ -> ()