]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Teach nfs_compare_sockaddr() to handle NULL arguments.
authorSteve Dickson <steved@redhat.com>
Mon, 25 Jan 2010 18:09:04 +0000 (13:09 -0500)
committerSteve Dickson <steved@redhat.com>
Mon, 25 Jan 2010 18:09:04 +0000 (13:09 -0500)
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
support/include/sockaddr.h

index 732514be6c747a2ce981a89b77ffeee372c63ce6..9af25439c7d59c60ec5fca8bcafad53be185a5ff 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef NFS_UTILS_SOCKADDR_H
 #define NFS_UTILS_SOCKADDR_H
 
+#include <libio.h>
 #include <stdbool.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -223,6 +224,9 @@ compare_sockaddr6(__attribute__ ((unused)) const struct sockaddr *sa1,
 static inline _Bool
 nfs_compare_sockaddr(const struct sockaddr *sa1, const struct sockaddr *sa2)
 {
+       if (sa1 == NULL || sa2 == NULL)
+               return false;
+
        if (sa1->sa_family == sa2->sa_family)
                switch (sa1->sa_family) {
                case AF_INET: