--- configure.ac.orig	Tue Feb 26 22:12:35 2002
+++ configure.ac	Wed Mar 27 14:28:02 2002
@@ -437,20 +437,6 @@
         ]
 )
 
-AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
-AC_TRY_RUN(
-	[
-#include <sys/types.h>
-#include <dirent.h>
-int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));}
-	],
-	[AC_MSG_RESULT(yes)], 
-	[
-		AC_MSG_RESULT(no)
-		AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
-	]
-)
-
 # Check whether user wants S/Key support
 SKEY_MSG="no" 
 AC_ARG_WITH(skey,
@@ -469,11 +455,13 @@
 			SKEY_MSG="yes" 
 	
 			AC_MSG_CHECKING([for s/key support])
-			AC_TRY_RUN(
+			AC_TRY_LINK(
 				[
-#include <stdio.h>
-#include <skey.h>
-int main() { char *ff = skey_keyinfo(""); ff=""; return 0; }
+				#include <stdio.h>
+				#include <skey.h>
+				],
+				[
+				char *ff = skey_keyinfo(""); ff="";
 				],
 				[AC_MSG_RESULT(yes)],
 				[
@@ -625,6 +613,10 @@
 			AC_MSG_RESULT(no)
 			AC_DEFINE(BROKEN_SNPRINTF)
 			AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
+		],
+		[
+			AC_MSG_RESULT(assuming no)
+			AC_DEFINE(BROKEN_SNPRINTF)
 		]
 	)
 fi
@@ -729,22 +721,21 @@
 
 		# Basic test to check for compatible version and correct linking
 		# *does not* test for RSA - that comes later.
-		AC_TRY_RUN(
+		AC_TRY_LINK(
 			[
-#include <string.h>
-#include <openssl/rand.h>
-int main(void) 
-{
-	char a[2048];
-	memset(a, 0, sizeof(a));
-	RAND_add(a, sizeof(a), sizeof(a));
-	return(RAND_status() <= 0);
-}
+			#include <string.h>
+			#include <openssl/rand.h>
+			],
+			[
+			char a[2048];
+			memset(a, 0, sizeof(a));
+			RAND_add(a, sizeof(a), sizeof(a));
+			return(RAND_status() <= 0);
 			],
 			[
 				found_crypto=1
 				break;
-			], []
+			], [ ]
 		)
 
 		if test ! -z "$found_crypto" ; then
@@ -800,26 +791,26 @@
 	else
 		LIBS="$saved_LIBS -lRSAglue -lrsaref"
 	fi
-	AC_TRY_RUN([
-#include <string.h>
-#include <openssl/rand.h>
-#include <openssl/rsa.h>
-#include <openssl/bn.h>
-#include <openssl/sha.h>
-int main(void) 
-{
-	int num; RSA *key; static unsigned char p_in[] = "blahblah";
-	unsigned char c[256], p[256];
-	memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
-	if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
-	num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
-	return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
-}
-	],
-	[
+	AC_TRY_LINK(
+		[
+		#include <string.h>
+		#include <openssl/rand.h>
+		#include <openssl/rsa.h>
+		#include <openssl/bn.h>
+		#include <openssl/sha.h>
+		],
+		[
+		int num; RSA *key; static unsigned char p_in[] = "blahblah";
+		unsigned char c[256], p[256];
+		memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
+		if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
+		num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
+		return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
+		],
+		[
 		rsa_works=1
 		break;
-	], [])
+		], [])
 done
 LIBS="$saved_LIBS"
 
@@ -856,6 +847,9 @@
 	[
 		AC_MSG_RESULT(no)
 		AC_MSG_ERROR(Your OpenSSL headers do not match your library)
+	],
+	[
+		AC_MSG_RESULT(hoping so)
 	]
 )
 
@@ -885,6 +879,12 @@
 		# Default to use of the rand helper if OpenSSL doesn't
 		# seed itself
 		USE_RAND_HELPER=yes
+	],
+	[
+		AC_MSG_RESULT(not sure)
+		# Default to use of the rand helper if OpenSSL doesn't
+		# seed itself
+		USE_RAND_HELPER=yes
 	]
 )
 
@@ -1457,7 +1457,10 @@
 #else
 main() { exit(0); }
 #endif
-		], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
+		],
+		[ true ],
+		[ AC_DEFINE(BROKEN_SNPRINTF) ],
+		[ AC_DEFINE(BROKEN_SNPRINTF) ]
 	)
 fi
 AC_SUBST(NO_SFTP)
@@ -1776,12 +1779,11 @@
 		]
 	)
 fi
-AC_CHECK_FILE("/dev/ptc", 
-	[
-		AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
-		have_dev_ptc=1
-	]
-)
+
+if test -f "/dev/ptc" ; then
+	AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
+	have_dev_ptc=1
+fi
 
 # Options from here on. Some of these are preset by platform above
 AC_ARG_WITH(mantype,
--- sftp-glob.c.orig	Tue Feb 12 19:10:33 2002
+++ sftp-glob.c	Wed Mar 27 14:27:30 2002
@@ -78,12 +78,9 @@
 	 * Solaris defines dirent->d_name as a one byte array and expects
 	 * you to hack around it.
 	 */
-#ifdef BROKEN_ONE_BYTE_DIRENT_D_NAME
-	strlcpy(ret->d_name, od->dir[od->offset++]->filename, MAXPATHLEN);
-#else
 	strlcpy(ret->d_name, od->dir[od->offset++]->filename,
-	    sizeof(ret->d_name));
-#endif
+		(sizeof(ret->d_name) <= sizeof(char))?
+		MAXPATHLEN: sizeof(ret->d_name));
 #ifdef __GNU_LIBRARY__
 	/*
 	 * Idiot glibc uses extensions to struct dirent for readdir with
