From bbf096cb5d20abbbac39bef75cacf057a7364745 Mon Sep 17 00:00:00 2001 From: Vladislav Grishenko Date: Thu, 14 Dec 2017 20:38:17 +0500 Subject: ppp: fix interface wildcard rename if kernel returns not zero, but picked index --- accel-pppd/ifcfg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/accel-pppd/ifcfg.c b/accel-pppd/ifcfg.c index a101d47..956ec6e 100644 --- a/accel-pppd/ifcfg.c +++ b/accel-pppd/ifcfg.c @@ -303,7 +303,7 @@ int __export ap_session_rename(struct ap_session *ses, const char *ifname, int l ifr.ifr_newname[len] = 0; r = net->sock_ioctl(SIOCSIFNAME, &ifr); - if (r && errno == EBUSY) { + if (r < 0 && errno == EBUSY) { net->sock_ioctl(SIOCGIFFLAGS, &ifr); ifr.ifr_flags &= ~IFF_UP; net->sock_ioctl(SIOCSIFFLAGS, &ifr); @@ -315,7 +315,7 @@ int __export ap_session_rename(struct ap_session *ses, const char *ifname, int l up = 1; } - if (r) { + if (r < 0) { if (!ses->ifname_rename) ses->ifname_rename = _strdup(ifr.ifr_newname); else @@ -325,7 +325,7 @@ int __export ap_session_rename(struct ap_session *ses, const char *ifname, int l if (strchr(ifr.ifr_newname, '%')) { ifr.ifr_ifindex = ses->ifindex; r = net->sock_ioctl(SIOCGIFNAME, &ifr); - if (r) { + if (r < 0) { log_ppp_error("failed to get new interface name: %s\n", strerror(errno)); return -1; } -- cgit v1.2.3