summaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2010-01-25 13:09:04 -0500
committerSteve Dickson <steved@redhat.com>2010-01-25 13:09:04 -0500
commit6318d601cf182d2848d397af323ca9c4fbdecb97 (patch)
tree39863274984e1309f0fb6630b9fa546abc440d78 /support
parentd9c22d2e825d050a89da8c798c56f3a96d2359b0 (diff)
downloadnfs-utils-6318d601cf182d2848d397af323ca9c4fbdecb97.tar.gz
nfs-utils-6318d601cf182d2848d397af323ca9c4fbdecb97.tar.xz
nfs-utils-6318d601cf182d2848d397af323ca9c4fbdecb97.zip
Teach nfs_compare_sockaddr() to handle NULL arguments.
Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'support')
-rw-r--r--support/include/sockaddr.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/support/include/sockaddr.h b/support/include/sockaddr.h
index 732514b..9af2543 100644
--- a/support/include/sockaddr.h
+++ b/support/include/sockaddr.h
@@ -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: