X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=directfifowatcher.ml;h=60c098710c48ca644ac031731fe675a2bd0c9deb;hb=ff59db26ff8e6f8ba6969ed93bb4cca88a3b7c2d;hp=f3e334db3366133d1285e47ec7ec4f62c582c796;hpb=5ecf5325f6e5ebcbff2c99f73662fb59d4a6ef86;p=vsys.git 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 _ -> ()