mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-17 15:32:21 +08:00
canutils/slcan: Work with CAN interfaces with names longer than 4 characters.
Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
This commit is contained in:

committed by
Xiang Xiao

parent
5585c9d347
commit
4fb47a6a6d
@@ -137,8 +137,7 @@ static int caninit(char *candev, int *s, struct sockaddr_can *addr,
|
||||
syslog(LOG_ERR, "Error opening CAN socket\n");
|
||||
return -1;
|
||||
}
|
||||
strncpy(ifr.ifr_name, candev, 4);
|
||||
ifr.ifr_name[4] = '\0';
|
||||
strlcpy(ifr.ifr_name, candev, IFNAMSIZ);
|
||||
ifr.ifr_ifindex = if_nametoindex(ifr.ifr_name);
|
||||
if (!ifr.ifr_ifindex)
|
||||
{
|
||||
|
Reference in New Issue
Block a user