X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fnetwork%2Fif_nametoindex.c;h=331413c68912daf5157988df60f3605c8d818750;hb=4554f155dd23a65fcdfd39f1d5af8af55ba37694;hp=cb6ec054efbd971fc362bc7dd24c738fc12eb997;hpb=8041af59881219c32267c3491bee43591d3c3fe6;p=musl diff --git a/src/network/if_nametoindex.c b/src/network/if_nametoindex.c index cb6ec054..331413c6 100644 --- a/src/network/if_nametoindex.c +++ b/src/network/if_nametoindex.c @@ -10,7 +10,7 @@ unsigned if_nametoindex(const char *name) struct ifreq ifr; int fd, r; - if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) return -1; + if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) return 0; strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name); r = ioctl(fd, SIOCGIFINDEX, &ifr); __syscall(SYS_close, fd);