filter-regex requires <util.h> for fparseln. Even though these were
previously defined in openbsd-compat.h, we want the same codebase to
work on both openbsd and elsewhere, which means we can't simply remove
the include <util.h> line in filter-regex. So, instead, we make things
"correct" by adding in the required util.h header to the compat layer.
---
 openbsd-compat/Makefile.am      |  2 +-
 openbsd-compat/includes.h       |  2 ++
 openbsd-compat/openbsd-compat.h |  8 --------
 openbsd-compat/util.h           | 36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 39 insertions(+), 9 deletions(-)
 create mode 100644 openbsd-compat/util.h

diff --git a/openbsd-compat/Makefile.am b/openbsd-compat/Makefile.am
index 95cc98f..d27169f 100644
--- a/openbsd-compat/Makefile.am
+++ b/openbsd-compat/Makefile.am
@@ -11,6 +11,6 @@ libopenbsd_compat_a_SOURCES =                                 
                \
 
 EXTRA_DIST =   asr.h base64.h bsd-misc.h bsd-waitpid.h chacha_private.h        
\
                defines.h entropy.h imsg.h includes.h log.h openbsd-compat.h    
\
-               sys/queue.h sys/tree.h vis.h xmalloc.h
+               sys/queue.h sys/tree.h util.h vis.h xmalloc.h
 
 AM_CPPFLAGS = -I$(top_srcdir)/smtpd -I$(top_srcdir)/openbsd-compat
diff --git a/openbsd-compat/includes.h b/openbsd-compat/includes.h
index b31496f..a01b889 100644
--- a/openbsd-compat/includes.h
+++ b/openbsd-compat/includes.h
@@ -78,4 +78,6 @@
 
 #include "entropy.h"
 
+#include "util.h"
+
 #endif /* INCLUDES_H */
diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h
index 2227c55..487744c 100644
--- a/openbsd-compat/openbsd-compat.h
+++ b/openbsd-compat/openbsd-compat.h
@@ -192,14 +192,6 @@ void explicit_bzero(void *p, size_t n);
 char * fgetln(FILE *stream, size_t *len);
 #endif
 
-#ifndef HAVE_FPARSELN
-char * fparseln(FILE *fp, size_t *size, size_t *lineno, const char str[3], int 
flags);
-#endif
-
-#ifndef HAVE_PIDFILE
-int pidfile(const char *basename);
-#endif
-
 #ifndef HAVE_PW_DUP
 struct passwd *pw_dup(const struct passwd *);
 #endif
diff --git a/openbsd-compat/util.h b/openbsd-compat/util.h
new file mode 100644
index 0000000..ea447f4
--- /dev/null
+++ b/openbsd-compat/util.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2015 Jason A. Donenfeld <[email protected]>.  All rights 
reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _UTIL_H
+#define _UTIL_H
+
+#ifndef HAVE_FPARSELN
+char * fparseln(FILE *fp, size_t *size, size_t *lineno, const char str[3], int 
flags);
+#endif
+
+#ifndef HAVE_PIDFILE
+int pidfile(const char *basename);
+#endif
+
+#endif /* _UTIL_H */
-- 
2.4.2


-- 
You received this mail because you are subscribed to [email protected]
To unsubscribe, send a mail to: [email protected]

Reply via email to