Applied James patch that fixes can_cn4linux.c file descriptor handling and make it compatible with can_serial_hub.
authoretisserant
Wed, 04 Jun 2008 10:59:09 +0200
changeset 471 bea45a091214
parent 470 86ff6646b721
child 472 4f5cb68098cf
Applied James patch that fixes can_cn4linux.c file descriptor handling and make it compatible with can_serial_hub.
drivers/can_can4linux/can_can4linux.c
--- a/drivers/can_can4linux/can_can4linux.c	Wed Jun 04 10:57:56 2008 +0200
+++ b/drivers/can_can4linux/can_can4linux.c	Wed Jun 04 10:59:09 2008 +0200
@@ -168,7 +168,7 @@
   dev_name[prefix_len+name_len] = 0;
 
   fd0 = open(dev_name, O_RDWR|o_flags);
-  if(fd0 <= 0){
+  if(fd0 == -1){
     fprintf(stderr,"!!! %s is unknown. See can4linux.c\n", dev_name);
     goto error_ret;
   }
@@ -192,8 +192,16 @@
 /***************************************************************************/
 int canClose_driver(CAN_HANDLE fd0)
 {
-  if((int)fd0<=0)
-    return -1;
-  close(fd0);
-  return 0;
-}
+  if((int)fd0 != -1) {
+      return close((int)fd0);
+  }
+
+  return -1;
+}
+
+int canfd_driver(CAN_HANDLE fd0)
+{
+        return ((int)fd0);
+}
+
+