Re: [Dnsmasq-discuss] [PATCH] Remove NULL check for intname.

2017-10-05 Thread Kevin Lyda
That's not actually correct in practice. If you'd like to see that I'm correct take the following two programs: foo.c: #include #include int main(int argc, char *argv[]) { if (strlen(argv[0]) == 0) { printf("Command empty"); } else { printf("Command not empty"); } } bar.c:

Re: [Dnsmasq-discuss] [PATCH] Remove NULL check for intname.

2017-10-05 Thread Roy Marples
On 05/10/2017 03:23, Rosen Penev wrote: @@ -1239,7 +1238,7 @@ static struct serverfd *allocate_sfd(union mysockaddr *addr, char *intname) #endif } - if (intname && strlen(intname) != 0) + if (!strlen(intname)) ifindex = if_nametoindex(intname); /* index == 0 when not binding

Re: [Dnsmasq-discuss] [PATCH] Remove NULL check for intname.

2017-10-05 Thread Kurt H Maier
On Wed, Oct 04, 2017 at 10:20:24PM -0700, ros...@gmail.com wrote: > > Compile time. Looks fine to me. To add to my commit message, > strlen(NULL) causes a segmentation fault, meaning intname cannot be > NULL. > > Actually I wonder how many more warnings I can find like this... Probably a lot,

Re: [Dnsmasq-discuss] [PATCH] Remove NULL check for intname.

2017-10-05 Thread Kevin Darbyshire-Bryant
On 05/10/17 06:20, ros...@gmail.com wrote: On Wed, 2017-10-04 at 20:43 -0700, Kurt H Maier wrote: On Wed, Oct 04, 2017 at 07:23:22PM -0700, Rosen Penev wrote: - if (intname && strlen(intname) != 0) + if (!strlen(intname)) ifindex = if_nametoindex(intname); /* index == 0 when not

Re: [Dnsmasq-discuss] [PATCH] Remove NULL check for intname.

2017-10-04 Thread rosenp
On Wed, 2017-10-04 at 20:43 -0700, Kurt H Maier wrote: > On Wed, Oct 04, 2017 at 07:23:22PM -0700, Rosen Penev wrote: > > > > - if (intname && strlen(intname) != 0) > > + if (!strlen(intname)) > > ifindex = if_nametoindex(intname); /* index == 0 when not > > binding to an interface */ >

Re: [Dnsmasq-discuss] [PATCH] Remove NULL check for intname.

2017-10-04 Thread Kurt H Maier
On Wed, Oct 04, 2017 at 07:23:22PM -0700, Rosen Penev wrote: > > - if (intname && strlen(intname) != 0) > + if (!strlen(intname)) > ifindex = if_nametoindex(intname); /* index == 0 when not binding to an > interface */ How much testing have you done of these patches? khm