[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH 6 of 6] CA-33440: when starting an stunnel process, careful to handle the case where we still do fork the binary directly i.e. that used by quicktest and the CLI



# HG changeset patch
# User David Scott <dave.scott@xxxxxxxxxxxxx>
# Date 1261169317 0
# Node ID bd8e01f7ec1b2bea5216a9da0361d194795926c2
# Parent  c6eff72def0786b1989ada4ca79d2617c45d15b3
CA-33440: when starting an stunnel process, careful to handle the case where we 
still do fork the binary directly i.e. that used by quicktest and the CLI.

Signed-off-by: David Scott <dave.scott@xxxxxxxxxxxxx>

diff -r c6eff72def07 -r bd8e01f7ec1b stunnel/stunnel.ml
--- a/stunnel/stunnel.ml        Fri Dec 18 20:48:36 2009 +0000
+++ b/stunnel/stunnel.ml        Fri Dec 18 20:48:37 2009 +0000
@@ -150,19 +150,20 @@
           Forkhelpers.Dup2(data_in, Unix.stdout);
           Forkhelpers.Dup2(logfd, Unix.stderr) ] in
        let fds_needed = [ Unix.stdin; Unix.stdout; Unix.stderr; config_out ] in
-       let args = [ "-fd"; config_out_uuid ] in
+       let args_external = [ "-fd"; config_out_uuid ] in
+          let args_internal = [ "-fd"; string_of_int 
(Unixext.int_of_file_descr config_out) ] in
        if use_external_fd_wrapper then begin
-        let cmdline = Printf.sprintf "Using commandline: %s\n" (String.concat 
" " (path::args)) in
+        let cmdline = Printf.sprintf "Using commandline: %s\n" (String.concat 
" " (path::args_external)) in
         write_to_log cmdline;
        end;
        t.pid <-
         if use_external_fd_wrapper
-        then Forkhelpers.safe_close_and_exec (Some data_in) (Some data_in) 
(Some logfd) [(config_out_uuid, config_out)] path args
+        then Forkhelpers.safe_close_and_exec (Some data_in) (Some data_in) 
(Some logfd) [(config_out_uuid, config_out)] path args_external
         else Forkhelpers.fork_and_exec ~pre_exec:
                          (fun _ -> 
                            List.iter Forkhelpers.do_fd_operation fdops;
                            Unixext.close_all_fds_except fds_needed) 
-                         (path::args);
+                         (path::args_internal);
        List.iter close [ data_in; config_out; ]; 
        (* Make sure we close config_in eventually *)
        finally
1 file changed, 5 insertions(+), 4 deletions(-)
stunnel/stunnel.ml |    9 +++++----


Attachment: xen-api-libs.hg-6.patch
Description: Text Data

_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.