summaryrefslogtreecommitdiff
path: root/devel/ocaml-annexlib/files/patch-syslog.ml
blob: 5b3b57b15b7685a8e0413f5090aebc7d75786bb4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--- syslog.ml.orig	2006-02-23 06:34:35 UTC
+++ syslog.ml
@@ -142,18 +142,18 @@ let syslog ?fac lev str =
     let realmsg = ref (Buffer.contents msg) in
       if String.length !realmsg > 1024 then begin
 	realmsg := String.sub !realmsg 0 1024;
-	String.blit "<truncated>\000" 0 !realmsg 1012 12
+	String.blit "<truncated>\000" 0 (Bytes.unsafe_of_string !realmsg) 1012 12
       end;
       begin try
-	ignore (Unix.write loginfo.fd !realmsg 0 (String.length !realmsg))
+	ignore (Unix.write_substring loginfo.fd !realmsg 0 (String.length !realmsg))
       with 
 	| Unix.Unix_error(_,_,_) ->
 	if List.mem `LOG_CONS loginfo.flags then
 	  log_console !realmsg
       end;
       if List.mem `LOG_PERROR loginfo.flags then begin
-	ignore (Unix.write Unix.stderr !realmsg 0 (String.length !realmsg));
-	ignore (Unix.write Unix.stderr "\n" 0 1)
+	ignore (Unix.write_substring Unix.stderr !realmsg 0 (String.length !realmsg));
+	ignore (Unix.write_substring Unix.stderr "\n" 0 1)
       end
 
 let closelog () =