From 4d3b3106c2210fa433241a91a7aae34e7840ba64 Mon Sep 17 00:00:00 2001 From: Sapan Bhatia Date: Thu, 26 Mar 2009 14:46:44 +0000 Subject: [PATCH] Adding some sanity checks for the fd passing module. --- unixsocketwatcher.ml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unixsocketwatcher.ml b/unixsocketwatcher.ml index 420d05a..99fe554 100644 --- a/unixsocketwatcher.ml +++ b/unixsocketwatcher.ml @@ -13,6 +13,8 @@ open Globals open Fdwatcher open Printf +exception Exec_failed + let close_if_open fd = (try (ignore(close fd);) with _ -> ()) type control_path_name = string @@ -48,7 +50,9 @@ let receive_event (listening_socket_spec:fname_and_fd) (_:fname_and_fd) = for i = 3 to 1023 do if (i != fd) then close_if_open(Obj.magic i) done; - execv execpath [|execpath;slice_name;sprintf "%d" fd|] (*with + execv execpath [|execpath;slice_name;sprintf "%d" fd|]; + raise Exec_failed + (*with Unix_error(num,str1,str2)->logprint "Error %d: %s (%s)" (Obj.magic num) str1 str2;raise (Unix_error(num,str1,str2))*) in logprint "Could not execve %s" execpath -- 2.43.0