From dbf3d168b720045328d476f3b9e5f5e45b4ab6de Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 7 May 2010 12:24:49 +0200 Subject: [PATCH] Use strrchr() insteaad of rindex(). The latter function is deprecated, some build environments do not support. --- src/bsd/device.c | 2 +- src/linux/device.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bsd/device.c b/src/bsd/device.c index c2cd34c..6674abd 100644 --- a/src/bsd/device.c +++ b/src/bsd/device.c @@ -64,7 +64,7 @@ bool setup_device(void) { device = xstrdup(DEFAULT_DEVICE); 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(!strcasecmp(type, "tun")) diff --git a/src/linux/device.c b/src/linux/device.c index 35c66d5..6363b12 100644 --- a/src/linux/device.c +++ b/src/linux/device.c @@ -61,7 +61,7 @@ bool setup_device(void) { if (netname != NULL) iface = xstrdup(netname); #else - iface = xstrdup(rindex(device, '/') ? rindex(device, '/') + 1 : device); + iface = xstrdup(strrchr(device, '/') ? strrchr(device, '/') + 1 : device); #endif device_fd = open(device, O_RDWR | O_NONBLOCK); @@ -105,7 +105,7 @@ bool setup_device(void) { device_type = DEVICE_TYPE_ETHERTAP; if(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); -- 2.25.1