From 78888bab8acd7fc1953a81e166ba3b95ce1dead4 Mon Sep 17 00:00:00 2001 From: dtucker Date: Fri, 1 Sep 2006 10:29:10 +0000 Subject: [PATCH] - (dtucker) [configure.ac includes.h openbsd-compat/glob.{c,h}] Explicitly test for GLOB_NOMATCH and use our glob functions if it's not found. Stops sftp from segfaulting when attempting to get a nonexistent file on Cygwin (previous versions of OpenSSH didn't use the native glob). Partly from and tested by Corinna Vinschen. --- ChangeLog | 5 +++++ configure.ac | 2 ++ includes.h | 3 ++- openbsd-compat/glob.c | 3 ++- openbsd-compat/glob.h | 3 ++- 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa581847..d08fbd70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,11 @@ sys/socket.h and unistd.h in various places - (dtucker) [openbsd-compat/bsd-cygwin_util.c] Fix implict declaration warnings for binary_open and binary_close. Patch from Corinna Vinschen. + - (dtucker) [configure.ac includes.h openbsd-compat/glob.{c,h}] Explicitly + test for GLOB_NOMATCH and use our glob functions if it's not found. + Stops sftp from segfaulting when attempting to get a nonexistent file on + Cygwin (previous versions of OpenSSH didn't use the native glob). Partly + from and tested by Corinna Vinschen. 20060831 - (djm) [CREDITS LICENCE Makefile.in auth.c configure.ac includes.h ] diff --git a/configure.ac b/configure.ac index b756d3be..cb5a3257 100644 --- a/configure.ac +++ b/configure.ac @@ -982,6 +982,8 @@ AC_TRY_COMPILE( ] ) +AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include ]) + AC_MSG_CHECKING([whether struct dirent allocates space for d_name]) AC_RUN_IFELSE( [AC_LANG_SOURCE([[ diff --git a/includes.h b/includes.h index 2101f13c..967fcc26 100644 --- a/includes.h +++ b/includes.h @@ -30,7 +30,8 @@ # include #endif #if defined(HAVE_GLOB_H) && defined(GLOB_HAS_ALTDIRFUNC) && \ - defined(GLOB_HAS_GL_MATCHC) + defined(GLOB_HAS_GL_MATCHC) && \ + defined(HAVE_DECL_GLOB_NOMATCH) && HAVE_DECL_GLOB_NOMATCH != 0 # include #endif #ifdef HAVE_ENDIAN_H diff --git a/openbsd-compat/glob.c b/openbsd-compat/glob.c index ec16b110..b3dd2b17 100644 --- a/openbsd-compat/glob.c +++ b/openbsd-compat/glob.c @@ -47,7 +47,8 @@ #include #if !defined(HAVE_GLOB) || !defined(GLOB_HAS_ALTDIRFUNC) || \ - !defined(GLOB_HAS_GL_MATCHC) + !defined(GLOB_HAS_GL_MATCHC) || \ + !defined(HAVE_DECL_GLOB_NOMATCH) || HAVE_DECL_GLOB_NOMATCH == 0 static long get_arg_max(void) diff --git a/openbsd-compat/glob.h b/openbsd-compat/glob.h index 4fdbfc1e..9ba07f76 100644 --- a/openbsd-compat/glob.h +++ b/openbsd-compat/glob.h @@ -38,7 +38,8 @@ /* OPENBSD ORIGINAL: include/glob.h */ #if !defined(HAVE_GLOB_H) || !defined(GLOB_HAS_ALTDIRFUNC) || \ - !defined(GLOB_HAS_GL_MATCHC) + !defined(GLOB_HAS_GL_MATCHC) || \ + !defined(HAVE_DECL_GLOB_NOMATCH) || HAVE_DECL_GLOB_NOMATCH == 0 #ifndef _GLOB_H_ #define _GLOB_H_ -- 2.45.1