Blame patches/libbsd-0.8.7.local.patch

Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/include/bsd/err.h libbsd-0.8.7/include/bsd/err.h
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/include/bsd/err.h	2017-06-06 04:21:05.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/include/bsd/err.h	2018-04-14 13:38:44.795802502 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -42,7 +42,10 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #include <stdarg.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__BEGIN_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __BEGIN_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+extern "C" {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 void warnc(int code, const char *format, ...)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 	__printflike(2, 3);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 void vwarnc(int code, const char *format, va_list ap)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -51,6 +54,9 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 	__printflike(3, 4);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 void verrc(int status, int code, const char *format, va_list ap)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 	__printflike(3, 0);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__END_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __END_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/include/bsd/libutil.h libbsd-0.8.7/include/bsd/libutil.h
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/include/bsd/libutil.h	2017-06-19 03:17:21.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/include/bsd/libutil.h	2018-04-14 13:38:44.795802502 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -53,7 +53,10 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 	ino_t	pf_ino;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 };
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__BEGIN_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __BEGIN_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+extern "C" {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 int humanize_number(char *buf, size_t len, int64_t bytes,
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
     const char *suffix, int scale, int flags);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 int expand_number(const char *_buf, uint64_t *_num);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -66,7 +69,10 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 int pidfile_remove(struct pidfh *pfh);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 char   *fparseln(FILE *, size_t *, size_t *, const char[3], int);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__END_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __END_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 /* humanize_number(3) */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #define HN_DECIMAL              0x01
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/include/bsd/md5.h libbsd-0.8.7/include/bsd/md5.h
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/include/bsd/md5.h	2017-06-19 03:17:21.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/include/bsd/md5.h	2018-04-14 13:38:44.795802502 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -30,7 +30,10 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #include <sys/cdefs.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #include <sys/types.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__BEGIN_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __BEGIN_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+extern "C" {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 void	 MD5Init(MD5_CTX *);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 void	 MD5Update(MD5_CTX *, const uint8_t *, size_t)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 		__attribute__((__bounded__(__string__,2,3)));
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -49,6 +52,9 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 char	*MD5Data(const uint8_t *, size_t, char *)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 		__attribute__((__bounded__(__string__,1,2)))
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 		__attribute__((__bounded__(__minbytes__,3,MD5_DIGEST_STRING_LENGTH)));
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__END_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __END_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif /* LIBBSD_MD5_H */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/include/bsd/nlist.h libbsd-0.8.7/include/bsd/nlist.h
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/include/bsd/nlist.h	2017-06-19 03:17:21.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/include/bsd/nlist.h	2018-04-14 13:38:44.795802502 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -88,8 +88,14 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #define N_FORMAT	"%08x"	/* namelist value format; XXX */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__BEGIN_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __BEGIN_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+extern "C" {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 extern int nlist(const char *filename, struct nlist *list);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__END_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __END_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/include/bsd/readpassphrase.h libbsd-0.8.7/include/bsd/readpassphrase.h
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/include/bsd/readpassphrase.h	2017-06-19 03:17:21.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/include/bsd/readpassphrase.h	2018-04-14 13:38:44.795802502 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -34,8 +34,14 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #include <sys/cdefs.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #include <sys/types.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__BEGIN_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __BEGIN_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+extern "C" {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 char * readpassphrase(const char *, char *, size_t, int);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__END_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __END_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif /* !LIBBSD_READPASSPHRASE_H */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/include/bsd/stdio.h libbsd-0.8.7/include/bsd/stdio.h
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/include/bsd/stdio.h	2017-06-06 04:21:05.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/include/bsd/stdio.h	2018-04-14 13:38:44.795802502 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -45,7 +45,10 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #include <sys/types.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__BEGIN_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __BEGIN_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+extern "C" {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 const char *fmtcheck(const char *, const char *);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 /* XXX: The function requires cooperation from the system libc to store the
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -73,7 +76,10 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #define fwopen(cookie, fn) funopen(cookie, NULL, fn, NULL, NULL)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 int fpurge(FILE *fp);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__END_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __END_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/include/bsd/stdlib.h libbsd-0.8.7/include/bsd/stdlib.h
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/include/bsd/stdlib.h	2017-08-05 13:20:00.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/include/bsd/stdlib.h	2018-04-14 13:58:02.519913671 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -46,7 +46,10 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #include <sys/stat.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #include <stdint.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__BEGIN_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __BEGIN_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+extern "C" {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 uint32_t arc4random(void);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 void arc4random_stir(void);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 void arc4random_addrandom(unsigned char *dat, int datlen);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -67,7 +70,7 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
                const unsigned char *table, unsigned endbyte);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 void *reallocf(void *ptr, size_t size);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-#if defined(_GNU_SOURCE) && defined(__GLIBC__) && !__GLIBC_PREREQ(2, 26)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#if defined(_GNU_SOURCE)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 void *reallocarray(void *ptr, size_t nmemb, size_t size);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -75,6 +78,9 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
                    const char **errstr);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 char *getbsize(int *headerlenp, long *blocksizep);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__END_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __END_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/include/bsd/string.h libbsd-0.8.7/include/bsd/string.h
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/include/bsd/string.h	2017-08-05 13:20:54.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/include/bsd/string.h	2018-04-14 13:57:51.871985815 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -36,15 +36,21 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #include <sys/cdefs.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #include <sys/types.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__BEGIN_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __BEGIN_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+extern "C" {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 size_t strlcpy(char *dst, const char *src, size_t siz);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 size_t strlcat(char *dst, const char *src, size_t siz);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 char *strnstr(const char *str, const char *find, size_t str_len);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 void strmode(mode_t mode, char *str);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-#if defined(_GNU_SOURCE) && defined(__GLIBC__) && !__GLIBC_PREREQ(2, 25)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#if defined(_GNU_SOURCE)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 void explicit_bzero(void *buf, size_t len);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__END_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __END_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/include/bsd/stringlist.h libbsd-0.8.7/include/bsd/stringlist.h
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/include/bsd/stringlist.h	2017-06-19 03:17:21.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/include/bsd/stringlist.h	2018-04-14 13:38:44.795802502 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -43,12 +43,18 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 	size_t	  sl_cur;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 } StringList;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__BEGIN_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __BEGIN_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+extern "C" {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 StringList	*sl_init(void);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 int		 sl_add(StringList *, char *);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 void		 sl_free(StringList *, int);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 char		*sl_find(StringList *, const char *);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 int		 sl_delete(StringList *, const char *, int);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__END_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __END_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif /* LIBBSD_STRINGLIST_H */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/include/bsd/unistd.h libbsd-0.8.7/include/bsd/unistd.h
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/include/bsd/unistd.h	2017-06-06 04:22:22.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/include/bsd/unistd.h	2018-04-14 13:38:44.795802502 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -45,7 +45,10 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #define S_ISTXT S_ISVTX
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__BEGIN_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __BEGIN_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+extern "C" {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 extern int optreset;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #ifdef LIBBSD_OVERLAY
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -68,6 +71,9 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 	__printflike(1, 2);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 int getpeereid(int s, uid_t *euid, gid_t *egid);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__END_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __END_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/include/bsd/vis.h libbsd-0.8.7/include/bsd/vis.h
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/include/bsd/vis.h	2017-06-19 03:17:21.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/include/bsd/vis.h	2018-04-14 13:38:44.799802474 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -74,7 +74,10 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #include <sys/cdefs.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__BEGIN_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __BEGIN_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+extern "C" {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 char	*vis(char *, int, int, int);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 int	strvis(char *, const char *, int);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 int	strvisx(char *, const char *, size_t, int);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -83,6 +86,9 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 int	strunvisx(char *, const char *, int);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 ssize_t strnunvis(char *, const char *, size_t);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 int	unvis(char *, int, int *, int);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__END_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __END_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif /* !LIBBSD_VIS_H */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/include/bsd/wchar.h libbsd-0.8.7/include/bsd/wchar.h
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/include/bsd/wchar.h	2017-06-06 04:06:45.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/include/bsd/wchar.h	2018-04-14 13:38:44.799802474 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -43,12 +43,18 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #include <sys/cdefs.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #include <sys/types.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__BEGIN_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __BEGIN_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+extern "C" {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 wchar_t *fgetwln(FILE *stream, size_t *len);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t size);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__END_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __END_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/src/funopen.c libbsd-0.8.7/src/funopen.c
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/src/funopen.c	2017-06-06 04:21:05.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/src/funopen.c	2018-04-14 14:00:26.386939154 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -137,7 +137,7 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 	return fopencookie(cookiewrap, mode, funcswrap);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 }
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-#elif defined(__MUSL__)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#elif defined(__MUSL__) || defined(__midipix__) /* remove this when we've updated to 1.16 */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 /*
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
  * This is unimplementable on musl based systems, and upstream has stated
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
  * they will not add the needed support to implement it. Just ignore this
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/src/getentropy.c libbsd-0.8.7/src/getentropy.c
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/src/getentropy.c	2017-06-06 04:21:24.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/src/getentropy.c	2018-04-14 14:17:41.264344594 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -40,6 +40,8 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #include "getentropy_aix.c"
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #elif defined(__hpux)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #include "getentropy_hpux.c"
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#elif defined(__midipix__)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include "getentropy_midipix.c"
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #else
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #error "No getentropy hooks defined for this platform."
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/src/getentropy_midipix.c libbsd-0.8.7/src/getentropy_midipix.c
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/src/getentropy_midipix.c	1970-01-01 01:00:00.000000000 +0100
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/src/getentropy_midipix.c	2018-04-14 14:19:03.568979997 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -0,0 +1,118 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* Temporary copy-paste from getentropy_linux.c until we get a native getentropy() implementation */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#define _POSIX_C_SOURCE 199309L
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#define _GNU_SOURCE     1
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <sys/types.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <sys/param.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <sys/ioctl.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <sys/resource.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <sys/syscall.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <sys/statvfs.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <sys/socket.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <sys/mount.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <sys/mman.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <sys/stat.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <sys/time.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <stdlib.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <stdint.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <stdio.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <link.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <termios.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <fcntl.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <signal.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <string.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <errno.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <unistd.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#include <time.h>
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+int     getentropy(void *buf, size_t len);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+static int gotdata(char *buf, size_t len);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+static int getentropy_urandom(void *buf, size_t len);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+int
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+getentropy(void *buf, size_t len)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+{
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        int ret = -1;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        if (len > 256) {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                errno = EIO;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                return (-1);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        }
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        ret = getentropy_urandom(buf, len);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        if (ret != -1)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                return (ret);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+	/* Oh well! */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+	raise(SIGKILL);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+	return -1;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+static int
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+gotdata(char *buf, size_t len)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+{
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        char    any_set = 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        size_t  i;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        for (i = 0; i < len; ++i)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                any_set |= buf[i];
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        if (any_set == 0)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                return (-1);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        return (0);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+static int
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+getentropy_urandom(void *buf, size_t len)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+{
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        struct stat st;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        size_t i;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        int fd, cnt, flags;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        int save_errno = errno;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+start:
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        flags = O_RDONLY;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef O_NOFOLLOW
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        flags |= O_NOFOLLOW;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef O_CLOEXEC
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        flags |= O_CLOEXEC;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        fd = open("/dev/urandom", flags, 0);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        if (fd == -1) {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                if (errno == EINTR)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                        goto start;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                goto nodevrandom;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        }
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifndef O_CLOEXEC
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        /* Lightly verify that the device node looks sane */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        if (fstat(fd, &st) == -1 || !S_ISCHR(st.st_mode)) {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                close(fd);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                goto nodevrandom;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        }
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        for (i = 0; i < len; ) {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                size_t wanted = len - i;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                ssize_t ret = read(fd, (char *)buf + i, wanted);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                if (ret == -1) {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                        if (errno == EAGAIN || errno == EINTR)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                                continue;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                        close(fd);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                        goto nodevrandom;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                }
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                i += ret;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        }
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        close(fd);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        if (gotdata(buf, len) == 0) {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                errno = save_errno;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+                return (0);             /* satisfied */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        }
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+nodevrandom:
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        errno = EIO;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+        return (-1);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/src/getpeereid.c libbsd-0.8.7/src/getpeereid.c
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/src/getpeereid.c	2017-06-06 04:06:45.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/src/getpeereid.c	2018-04-14 14:01:46.514396572 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -40,7 +40,7 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 getpeereid(int s, uid_t *euid, gid_t *egid)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 /* XXX: This should be autodetected at build time instead. */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-#if defined(__linux__)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#if defined(__linux__) || defined(__midipix__)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 	struct ucred cred;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #elif defined(__OpenBSD__)
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 	struct sockpeercred cred;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/src/hash/sha512.h libbsd-0.8.7/src/hash/sha512.h
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/src/hash/sha512.h	2017-06-06 04:21:05.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/src/hash/sha512.h	2018-04-14 13:38:44.799802474 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -39,7 +39,10 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 	unsigned char buf[128];
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 } SHA512_CTX;
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__BEGIN_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __BEGIN_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+extern "C" {
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 void	SHA512_Init(SHA512_CTX *);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 void	SHA512_Update(SHA512_CTX *, const void *, size_t);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -48,6 +51,9 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 char   *SHA512_File(const char *, char *);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 char   *SHA512_FileChunk(const char *, char *, off_t, off_t);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 char   *SHA512_Data(const void *, unsigned int, char *);
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
-__END_DECLS
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifdef __cplusplus
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+/* __END_DECLS */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif /* !_SHA512_H_ */
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
diff -Nru libbsd-0.8.7.orig/src/setproctitle.c libbsd-0.8.7/src/setproctitle.c
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
--- libbsd-0.8.7.orig/src/setproctitle.c	2017-07-17 00:47:19.000000000 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+++ libbsd-0.8.7/src/setproctitle.c	2018-04-14 14:05:35.448846935 +0200
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -280,6 +280,7 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 		*++nul = '\0';
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 	}
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 }
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#ifndef __midipix__
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 __asm__(".symver setproctitle_impl,setproctitle@@LIBBSD_0.5");
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 /* The original function introduced in 0.2 was a stub, it only got implemented
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
@@ -293,3 +294,4 @@
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 	__attribute__((alias("setproctitle_impl")));
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 #endif
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
 __asm__(".symver setproctitle_stub,setproctitle@LIBBSD_0.2");
Lucio Andrés Illanes Albornoz (arab, vxp) 98bbb0
+#endif