summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@mail.ru>2017-12-14 20:38:17 +0500
committerVladislav Grishenko <themiron@mail.ru>2017-12-14 20:38:17 +0500
commitbbf096cb5d20abbbac39bef75cacf057a7364745 (patch)
tree0d176f45e9852b036b030ea77f72473a2701dfc9
parentae72e179afa46d82865aa8d459b32cc27541e4a7 (diff)
downloadaccel-ppp-bbf096cb5d20abbbac39bef75cacf057a7364745.tar.gz
accel-ppp-bbf096cb5d20abbbac39bef75cacf057a7364745.zip
ppp: fix interface wildcard rename if kernel returns not zero, but picked index
-rw-r--r--accel-pppd/ifcfg.c6
1 files 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;
}