equal
deleted
inserted
replaced
106 struct ifreq ifr; |
106 struct ifreq ifr; |
107 struct sockaddr_can addr; |
107 struct sockaddr_can addr; |
108 int err; |
108 int err; |
109 CAN_HANDLE fd0 = malloc(sizeof(int)); |
109 CAN_HANDLE fd0 = malloc(sizeof(int)); |
110 |
110 |
111 *(int*)fd0 = CAN_SOCKET(PF_CAN, SOCK_RAW, 0); |
111 *(int*)fd0 = CAN_SOCKET(PF_CAN, SOCK_RAW, CAN_RAW); |
112 if(*(int*)fd0 < 0){ |
112 if(*(int*)fd0 < 0){ |
113 fprintf(stderr,"Socket creation failed.\n"); |
113 fprintf(stderr,"Socket creation failed.\n"); |
114 goto error_ret; |
114 goto error_ret; |
115 } |
115 } |
116 |
116 |
131 } |
131 } |
132 |
132 |
133 return fd0; |
133 return fd0; |
134 |
134 |
135 error_close: |
135 error_close: |
136 CAN_CLOSE(fd0); |
136 CAN_CLOSE(*(int*)fd0); |
137 |
137 |
138 error_ret: |
138 error_ret: |
139 free(fd0); |
139 free(fd0); |
140 return NULL; |
140 return NULL; |
141 } |
141 } |