|
Message-ID: <20160117223455.GL238@brightrain.aerifal.cx> Date: Sun, 17 Jan 2016 17:34:55 -0500 From: Rich Felker <dalias@...c.org> To: musl@...ts.openwall.com Subject: Re: [PATCH] fix if_nametoindex return value when socket open fails On Fri, Jan 15, 2016 at 09:39:44AM +0000, Ron Yorston wrote: > The return value of if_nametoindex is unsigned; it should return 0 > on error. > --- > src/network/if_nametoindex.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/network/if_nametoindex.c b/src/network/if_nametoindex.c > index cb6ec05..331413c 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); Committed. Rich
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.