From: John Else Date: Wed, 26 Jan 2011 17:39:05 +0000 (+0000) Subject: CA-47759 - CLI command vm-reboot failed: Stunnel process 17840 existed with exit... X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=aa076f1d9c61039fadae5895f92981652cd03124;p=xcp%2Fxen-api.git CA-47759 - CLI command vm-reboot failed: Stunnel process 17840 existed with exit code 0 Remove the really_write function and instead use Unixext.really_write. Signed-off-by: John Else --- diff --git a/ocaml/xapi/cli_protocol.ml b/ocaml/xapi/cli_protocol.ml index 527d3988..fefd4e3a 100644 --- a/ocaml/xapi/cli_protocol.ml +++ b/ocaml/xapi/cli_protocol.ml @@ -199,11 +199,8 @@ let marshal_message = function | Response x -> marshal_int 10 ^ (marshal_response x) | Blob x -> marshal_int 11 ^ (marshal_blob_header x) -let really_write (fd: Unix.file_descr) buf ofs len = - if Unix.write fd buf ofs len <> len then raise End_of_file - let write_string (fd: Unix.file_descr) buf = - really_write fd buf 0 (String.length buf) + Unixext.really_write fd buf 0 (String.length buf) (** Marshal a message to a file descriptor prefixing it with total header length *) let marshal (fd: Unix.file_descr) x = diff --git a/ocaml/xe-cli/newcli.ml b/ocaml/xe-cli/newcli.ml index a0c4726d..d668edc4 100644 --- a/ocaml/xe-cli/newcli.ml +++ b/ocaml/xe-cli/newcli.ml @@ -312,7 +312,7 @@ let main_loop ifd ofd = let left = ref length in while !left > 0 do let n = Unix.read fd buffer 0 (min (String.length buffer) !left) in - really_write ofd buffer 0 n; + Unixext.really_write ofd buffer 0 n; left := !left - n done; marshal ofd (Blob End); @@ -396,7 +396,7 @@ let main_loop ifd ofd = while not(!finished) do let num = input ic buffer 0 (String.length buffer) in begin try - really_write fd buffer 0 num; + Unixext.really_write fd buffer 0 num; with Unix.Unix_error (a,b,c) -> raise (ClientSideError (Printf.sprintf "%s: %s, %s." (Unix.error_message a) b c))