mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-22 10:30:13 +00:00
Better failure handling in linuxradiodrv
This commit is contained in:
parent
5fed4a3f1c
commit
113d9761f7
@ -67,6 +67,9 @@ static int
|
||||
init(void)
|
||||
{
|
||||
sockbuf = malloc(MAX_PACKET_SIZE);
|
||||
if (sockbuf == 0) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -163,8 +166,13 @@ on(void)
|
||||
return 0;
|
||||
} else {
|
||||
struct ifreq ifr;
|
||||
strncpy((char *)ifr.ifr_name, "wpan0", IFNAMSIZ); // TODO: make interface configurable
|
||||
ioctl(sockfd, SIOCGIFINDEX, &ifr);
|
||||
// TODO: interface should not be hard-coded
|
||||
strncpy((char *)ifr.ifr_name, "wpan0", IFNAMSIZ);
|
||||
int err = ioctl(sockfd, SIOCGIFINDEX, &ifr);
|
||||
if (err == -1) {
|
||||
perror ("linuxradio ioctl()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct sockaddr_ll sll;
|
||||
sll.sll_family = AF_PACKET;
|
||||
|
Loading…
Reference in New Issue
Block a user