Use strrchr() insteaad of rindex().
The latter function is deprecated, some build environments do not support.
This commit is contained in:
parent
eda7179874
commit
dbf3d168b7
2 changed files with 3 additions and 3 deletions
|
@ -64,7 +64,7 @@ bool setup_device(void) {
|
||||||
device = xstrdup(DEFAULT_DEVICE);
|
device = xstrdup(DEFAULT_DEVICE);
|
||||||
|
|
||||||
if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
|
if(!get_config_string(lookup_config(config_tree, "Interface"), &iface))
|
||||||
iface = xstrdup(rindex(device, '/') ? rindex(device, '/') + 1 : device);
|
iface = xstrdup(strrchr(device, '/') ? strrchr(device, '/') + 1 : device);
|
||||||
|
|
||||||
if(get_config_string(lookup_config(config_tree, "DeviceType"), &type)) {
|
if(get_config_string(lookup_config(config_tree, "DeviceType"), &type)) {
|
||||||
if(!strcasecmp(type, "tun"))
|
if(!strcasecmp(type, "tun"))
|
||||||
|
|
|
@ -61,7 +61,7 @@ bool setup_device(void) {
|
||||||
if (netname != NULL)
|
if (netname != NULL)
|
||||||
iface = xstrdup(netname);
|
iface = xstrdup(netname);
|
||||||
#else
|
#else
|
||||||
iface = xstrdup(rindex(device, '/') ? rindex(device, '/') + 1 : device);
|
iface = xstrdup(strrchr(device, '/') ? strrchr(device, '/') + 1 : device);
|
||||||
#endif
|
#endif
|
||||||
device_fd = open(device, O_RDWR | O_NONBLOCK);
|
device_fd = open(device, O_RDWR | O_NONBLOCK);
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ bool setup_device(void) {
|
||||||
device_type = DEVICE_TYPE_ETHERTAP;
|
device_type = DEVICE_TYPE_ETHERTAP;
|
||||||
if(iface)
|
if(iface)
|
||||||
free(iface);
|
free(iface);
|
||||||
iface = xstrdup(rindex(device, '/') ? rindex(device, '/') + 1 : device);
|
iface = xstrdup(strrchr(device, '/') ? strrchr(device, '/') + 1 : device);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger(LOG_INFO, "%s is a %s", device, device_info);
|
logger(LOG_INFO, "%s is a %s", device, device_info);
|
||||||
|
|
Loading…
Reference in a new issue