Kyle Robbertze pushed to branch upstream at Debian OCaml Maintainers / ocaml-cry
Commits: aac8a37f by Kyle Robbertze at 2024-04-06T09:29:27+01:00 New upstream version 1.0.3 - - - - - 5 changed files: - CHANGES - cry.opam - dune-project - src/cry.ml - src/cry_stubs.c Changes: ===================================== CHANGES ===================================== @@ -1,3 +1,9 @@ +1.0.3 (2024-03-18) +===== +* Raise a proper error when non-blocking connection + fails. +* Fix poll segfault. + 1.0.2 (2024-01-08) ====== * Use `poll` for select when available. ===================================== cry.opam ===================================== @@ -1,6 +1,6 @@ # This file is generated by dune, edit dune-project instead opam-version: "2.0" -version: "1.0.2" +version: "1.0.3" synopsis: "OCaml client for the various icecast & shoutcast source protocols" description: "The cry library is an implementation of the various icecast & shoutcast protocols to connect to streaming servers such as icecast" ===================================== dune-project ===================================== @@ -1,5 +1,5 @@ (lang dune 2.8) -(version 1.0.2) +(version 1.0.3) (name cry) (source (github savonet/ocaml-cry)) (license GPL-2.0-only) ===================================== src/cry.ml ===================================== @@ -163,14 +163,15 @@ let connect_sockaddr ?bind_address ?timeout sockaddr = Printexc.raise_with_backtrace exn bt); let do_timeout = timeout <> None in let check_timeout () = - match timeout with - | Some timeout -> - (* Block in a select call for [timeout] seconds. *) - let _, w, _ = select [] [socket] [] timeout in - if w = [] then raise Timeout; + let timeout = Option.get timeout in + (* Block in a select call for [timeout] seconds. *) + let _, w, _ = select [] [socket] [] timeout in + if w = [] then raise Timeout; + match Unix.getsockopt_error socket with + | Some err -> raise (Unix.Unix_error (err, "connect", "")) + | None -> Unix.clear_nonblock socket; socket - | None -> assert false in let finish () = try ===================================== src/cry_stubs.c ===================================== @@ -109,7 +109,7 @@ CAMLprim value caml_cry_poll(value _read, value _write, value _err, nwrite++; } if (fds[n].revents & POLLERR) { - Store_field(_pread, nerr, Val_fd(fds[n].fd)); + Store_field(_perr, nerr, Val_fd(fds[n].fd)); nerr++; } } View it on GitLab: https://salsa.debian.org/ocaml-team/ocaml-cry/-/commit/aac8a37f8fa7d5ccd084557ae751cd94393265b4 -- View it on GitLab: https://salsa.debian.org/ocaml-team/ocaml-cry/-/commit/aac8a37f8fa7d5ccd084557ae751cd94393265b4 You're receiving this email because of your account on salsa.debian.org.