]> granicus.if.org Git - sudo/commitdiff
Use INADDR_NONE instead of casting -1 to in_addr_t (which may not exist).
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 12 Oct 2010 14:31:21 +0000 (10:31 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 12 Oct 2010 14:31:21 +0000 (10:31 -0400)
plugins/sudoers/interfaces.c

index dbfba23041dbb11ea8d28ba2f2ec645ed1115552..acf056829f3dd302a83207b1f44fa961cc875faa 100644 (file)
 #include "sudoers.h"
 #include "interfaces.h"
 
+#ifndef INADDR_NONE
+# define INADDR_NONE ((unsigned int)-1)
+#endif
+
 /*
  * Parse a space-delimited list of IP address/netmask pairs and
  * store in a list of interface structures.
@@ -83,8 +87,8 @@ set_interfaces(const char *ai)
            ifp->family = AF_INET;
            ifp->addr.ip4.s_addr = inet_addr(addr);
            ifp->netmask.ip4.s_addr = inet_addr(mask);
-           if (ifp->addr.ip4.s_addr == (in_addr_t)-1 ||
-               ifp->netmask.ip4.s_addr == (in_addr_t)-1) {
+           if (ifp->addr.ip4.s_addr == INADDR_NONE ||
+               ifp->netmask.ip4.s_addr == INADDR_NONE) {
                efree(ifp);
                continue;
            }