[openssh-commits] [openssh] 04/05: Hook up fnmatch for platforms that don't have it.

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Nov 1 18:28:11 AEDT 2019


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit 0e3c5bc50907d2058407641b5a3581b7eda91b7e
Author: Darren Tucker <dtucker at dtucker.net>
Date:   Fri Nov 1 18:24:29 2019 +1100

    Hook up fnmatch for platforms that don't have it.
---
 configure.ac                    |  2 ++
 openbsd-compat/Makefile.in      |  1 +
 openbsd-compat/fnmatch.c        |  6 ++++++
 openbsd-compat/fnmatch.h        | 11 +++++++++--
 openbsd-compat/openbsd-compat.h |  1 +
 scp.c                           |  2 ++
 6 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index a9cbfed0..dcb44915 100644
--- a/configure.ac
+++ b/configure.ac
@@ -382,6 +382,7 @@ AC_CHECK_HEADERS([ \
 	features.h \
 	fcntl.h \
 	floatingpoint.h \
+	fnmatch.h \
 	getopt.h \
 	glob.h \
 	ia.h \
@@ -1738,6 +1739,7 @@ AC_CHECK_FUNCS([ \
 	fchown \
 	fchownat \
 	flock \
+	fnmatch \
 	freeaddrinfo \
 	freezero \
 	fstatfs \
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in
index 1162dc55..94fb0a55 100644
--- a/openbsd-compat/Makefile.in
+++ b/openbsd-compat/Makefile.in
@@ -25,6 +25,7 @@ OPENBSD=base64.o \
 	explicit_bzero.o \
 	fmt_scaled.o \
 	freezero.o \
+	fnmatch.o \
 	getcwd.o \
 	getgrouplist.o \
 	getopt_long.o \
diff --git a/openbsd-compat/fnmatch.c b/openbsd-compat/fnmatch.c
index 88d5dbc3..da841d20 100644
--- a/openbsd-compat/fnmatch.c
+++ b/openbsd-compat/fnmatch.c
@@ -85,6 +85,11 @@
  * path delimiter must be aware that 0x5C is NOT unique within SHIFT-JIS.
  */
 
+/* OPENBSD ORIGINAL: lib/libc/gen/fnmatch.c */
+
+#include "includes.h"
+#ifndef HAVE_FNMATCH
+
 #include <fnmatch.h>
 #include <string.h>
 #include <ctype.h>
@@ -487,3 +492,4 @@ firstsegment:
 	/* Pattern didn't match to the end of string. */
 	return FNM_NOMATCH;
 }
+#endif /* HAVE_FNMATCH */
diff --git a/openbsd-compat/fnmatch.h b/openbsd-compat/fnmatch.h
index 4b27d06c..b54de01f 100644
--- a/openbsd-compat/fnmatch.h
+++ b/openbsd-compat/fnmatch.h
@@ -32,10 +32,16 @@
  *	@(#)fnmatch.h	8.1 (Berkeley) 6/2/93
  */
 
+/* OPENBSD ORIGINAL: include/fnmatch.h */
+
+#ifndef HAVE_FNMATCH_H
+
 #ifndef	_FNMATCH_H_
 #define	_FNMATCH_H_
 
+#ifdef HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
+#endif
 
 #define	FNM_NOMATCH	1	/* Match failed. */
 #define	FNM_NOSYS	2	/* Function not supported (unused). */
@@ -50,8 +56,9 @@
 #define	FNM_FILE_NAME	FNM_PATHNAME
 #endif
 
-__BEGIN_DECLS
+/* __BEGIN_DECLS */
 int	 fnmatch(const char *, const char *, int);
-__END_DECLS
+/* __END_DECLS */
 
 #endif /* !_FNMATCH_H_ */
+#endif /* ! HAVE_FNMATCH_H */
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index 97b344b6..afe882f9 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -47,6 +47,7 @@
 #include "rmd160.h"
 #include "md5.h"
 #include "blf.h"
+#include "fnmatch.h"
 
 #ifndef HAVE_BASENAME
 char *basename(const char *path);
diff --git a/scp.c b/scp.c
index 0348d067..762286c7 100644
--- a/scp.c
+++ b/scp.c
@@ -94,7 +94,9 @@
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
+#ifdef HAVE_FNMATCH_H
 #include <fnmatch.h>
+#endif
 #include <limits.h>
 #include <locale.h>
 #include <pwd.h>

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list