- dtucker@cvs.openbsd.org 2007/12/27 14:22:08
     [servconf.c canohost.c misc.c channels.c sshconnect.c misc.h ssh-keyscan.c
     sshd.c]
     Add a small helper function to consistently handle the EAI_SYSTEM error
     code of getaddrinfo.  Prompted by vgiffin at apple com via bz #1417.
     ok markus@ stevesk@
diff --git a/misc.c b/misc.c
index 625a343..2ca0414 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.65 2006/11/23 01:35:11 ray Exp $ */
+/* $OpenBSD: misc.c,v 1.66 2007/12/27 14:22:08 dtucker Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  * Copyright (c) 2005,2006 Damien Miller.  All rights reserved.
@@ -42,6 +42,7 @@
 
 #include <errno.h>
 #include <fcntl.h>
+#include <netdb.h>
 #ifdef HAVE_PATHS_H
 # include <paths.h>
 #include <pwd.h>
@@ -120,6 +121,14 @@
 	return (0);
 }
 
+const char *
+ssh_gai_strerror(int gaierr)
+{
+        if (gaierr == EAI_SYSTEM)
+                return strerror(errno);
+        return gai_strerror(gaierr);
+}
+
 /* disable nagle on socket */
 void
 set_nodelay(int fd)