On 05/10/2017 03:23, Rosen Penev wrote:
@@ -1239,7 +1238,7 @@ static struct serverfd *allocate_sfd(union mysockaddr 
*addr, char *intname)
- if (intname && strlen(intname) != 0)
+  if (!strlen(intname))
      ifindex = if_nametoindex(intname); /* index == 0 when not binding to an 
interface */
/* may have a suitable one already */

I have no comment on the functionality of the patch (it if intname needs to be NULL checked or not), but this is not a good use of strlen.

This could be re-written as

if (*intname != '\0')

Which saves a function call because the actual length of the string is not used.


Dnsmasq-discuss mailing list

Reply via email to