From: Jérémie D. <Ba...@us...> - 2011-03-18 22:34:49
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via 2575398f14920cd962c2ed4aae14093114df62ca (commit) from b628b5a4fac1280c9f818dad667e8ba832222d4d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2575398f14920cd962c2ed4aae14093114df62ca Author: Jérémie Dimino <je...@di...> Date: Fri Mar 18 23:33:56 2011 +0100 [info] closes fds on errors ----------------------------------------------------------------------- Changes: diff --git a/info/control2011/src/can/can_stubs.c b/info/control2011/src/can/can_stubs.c index 93d63fb..9cdc4b3 100644 --- a/info/control2011/src/can/can_stubs.c +++ b/info/control2011/src/can/can_stubs.c @@ -32,13 +32,19 @@ CAMLprim value ocaml_can_open_can_file_descr(value iface) struct ifreq ifr; strcpy(ifr.ifr_name, String_val(iface)); /* ifr.ifr_ifindex gets filled with that device's index */ - if (ioctl(fd, SIOCGIFINDEX, &ifr) < 0) uerror("ioctl", Nothing); + if (ioctl(fd, SIOCGIFINDEX, &ifr) < 0) { + close(fd); + uerror("ioctl", Nothing); + } /* Select that CAN interface, and bind the socket to it. */ struct sockaddr_can addr; addr.can_family = AF_CAN; addr.can_ifindex = ifr.ifr_ifindex; - if (bind(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0) uerror("bind", Nothing); + if (bind(fd, (struct sockaddr*)&addr, sizeof(addr)) < 0) { + close(fd); + uerror("bind", Nothing); + } return Val_int(fd); } diff --git a/info/control2011/src/driver/krobot_driver.ml b/info/control2011/src/driver/krobot_driver.ml index dab0a02..59f3851 100644 --- a/info/control2011/src/driver/krobot_driver.ml +++ b/info/control2011/src/driver/krobot_driver.ml @@ -35,6 +35,7 @@ lwt () = Krobot_can_bus.recv can >>= Krobot_can.send bus done with exn -> + lwt () = Krobot_can_bus.close can in (* Make sure no more messages are sent on the CAN bus. *) set_active false; (* This is just here to keep a reference to [ev]. *) hooks/post-receive -- krobot |