Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add statfs and funopen wrapper.
Vsevolod Stakhov committed 11 years ago
commit 51c74700e85149fdf9c9196e035b0ac554499c09
parent 73c9a3f
4 files changed +16 -7
modified compat/Makefile.am
@@ -9,10 +9,7 @@ libbsd_compat_la_SOURCES= basename.c \
				gr_util.c \
				humanize_number.c \
				strtonum.c \
-
				strnstr.c
+
				strnstr.c \
+
				funopen.c

libbsd_compat_la_CFLAGS=	$(pkg_common_cflags) -shared
-

-
if HAVE_LIBBSD
-
libbsd_compat_la_LIBADD=	-lbsd
-
endif
modified compat/bsd_compat.h
@@ -150,4 +150,13 @@ char * strnstr(const char *s, const char *find, size_t slen);
#endif
#endif

+
#if !HAVE_FUNOPEN
+
#if !HAVE_FOPENCOOKIE
+
# error "Your system has neither funopen nor fopencookie, cannot continue"
+
#endif
+
FILE * funopen(const void *cookie, int (*readfn)(void *, char *, int),
+
         int (*writefn)(void *, const char *, int),
+
         off_t (*seekfn)(void *, off_t, int), int (*closefn)(void *));
+
#endif
+

#endif
modified compat/strnstr.c
@@ -34,6 +34,7 @@
#include <sys/cdefs.h>
#include <string.h>

+
#if !HAVE_STRNSTR
/*
 * Find the first occurrence of find in s, where the search is limited to the
 * first slen characters of s.
@@ -58,4 +59,4 @@ strnstr(const char *s, const char *find, size_t slen)
        }
        return ((char *)s);
}
-

+
#endif
modified configure.ac
@@ -110,6 +110,7 @@ AC_CHECK_HEADERS_ONCE([osreldate.h])
AC_CHECK_HEADERS_ONCE([sys/socket.h])
AC_CHECK_HEADERS_ONCE([netinet/in.h])
AC_CHECK_HEADERS_ONCE([netinet/in6.h])
+
AC_CHECK_HEADERS_ONCE([sys/statfs.h])
AC_CHECK_HEADERS_ONCE([dirent.h], [sys/ndir.h], [sys/dir.h], [ndir.h])
AC_CHECK_HEADERS_ONCE([bsd/stdlib.h])
AC_CHECK_HEADERS_ONCE([bsd/string.h]) 
@@ -133,6 +134,7 @@ AC_CHECK_FUNCS_ONCE([strerror_r])
AC_CHECK_FUNCS_ONCE([strtonum])
AC_CHECK_FUNCS_ONCE([strnstr])
AC_CHECK_FUNCS_ONCE([funopen])
+
AC_CHECK_FUNCS_ONCE([fopencookie])
AC_CHECK_DECLS(
	[[fstatat], [openat], [unlinkat], [readlinkat], [faccessat]],
	[], [], [
@@ -158,7 +160,7 @@ AC_CHECK_MEMBERS([struct in6_addr.s6_addr32,
	struct sockaddr_in6.sin6_len, 
	struct sockaddr_storage.ss_len,
	struct sockaddr_storage.ss_family,
-
	struct sockaddr_storage.__ss_family], , ,
+
	struct sockaddr_storage.__ss_family], [], [],
[#include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>