@@ -1,8 +1,8 @@
11diff --git a/configure.ac b/configure.ac
2−index 5a432d4..a69ae0b 100644
2+index c909878..60c540e 100644
33--- a/configure.ac
44+++ b/configure.ac
5−@@ -55,7 +55,7 @@ AS_CASE([$host_os],
5+@@ -59,7 +59,7 @@ AS_CASE([$host_os],
66 )
77
88 # Checks for header files.
@@ -10,10 +10,10 @@ index 5a432d4..a69ae0b 100644
1010+AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h stdio_ext.h])
1111
1212 # Checks for typedefs, structures, and compiler characteristics.
13− AC_TYPE_UID_T
14−@@ -143,6 +143,31 @@ AC_CHECK_FUNCS([clearenv dirfd fopencookie __fpurge \
13+ AC_C_INLINE
14+@@ -146,6 +146,31 @@ AC_CHECK_FUNCS([clearenv dirfd fopencookie __fpurge \
1515 pstat_getproc sysconf])
16− AM_CONDITIONAL(HAVE_GETENTROPY, [test "x$ac_cv_func_getentropy" = "xtrue"])
16+ AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xtrue"])
1717
1818+HostOS=`echo "$host" | sed 's/.*-//'`
1919+os_is_macosx=false
@@ -31,7 +31,7 @@ index 5a432d4..a69ae0b 100644
3131+ os_is_macosx=false
3232+ nonLinuxOS=false
3333+ ;;
34−+esac
34++esac
3535+AM_CONDITIONAL([IS_DARWIN], [test x$os_is_macosx = xtrue])
3636+AM_COND_IF([IS_DARWIN],
3737+ [AC_DEFINE([IS_DARWIN], [1], [Get HostOS Type is Darwin])])
@@ -44,12 +44,12 @@ index 5a432d4..a69ae0b 100644
4444 Makefile
4545 include/Makefile
4646diff --git a/include/bsd/libutil.h b/include/bsd/libutil.h
47−index ebb6160..ce882bf 100644
47+index 45b3b15..d0d4043 100644
4848--- a/include/bsd/libutil.h
4949+++ b/include/bsd/libutil.h
5050@@ -39,7 +39,9 @@
51− #ifndef _LIBUTIL_H_
52− #define _LIBUTIL_H_
51+ #ifndef LIBBSD_LIBUTIL_H
52+ #define LIBBSD_LIBUTIL_H
5353
5454+#ifdef HAVE_FEATURES_H
5555 #include <features.h>
@@ -58,10 +58,10 @@ index ebb6160..ce882bf 100644
5858 #include <sys/types.h>
5959 #include <stdint.h>
6060diff --git a/include/bsd/stdio.h b/include/bsd/stdio.h
61−index 7697425..ef34c4f 100644
61+index 4b69983..8e2ac75 100644
6262--- a/include/bsd/stdio.h
6363+++ b/include/bsd/stdio.h
64−@@ -44,12 +44,16 @@
64+@@ -48,12 +48,16 @@
6565 __BEGIN_DECLS
6666 const char *fmtcheck(const char *, const char *);
6767
@@ -69,9 +69,9 @@ index 7697425..ef34c4f 100644
6969 /* XXX: The function requires cooperation from the system libc to store the
7070 * line buffer in the FILE struct itself. */
7171 char *fgetln(FILE *fp, size_t *lenp)
72− __attribute__((deprecated("This functions cannot be safely ported, "
73− "use getline(3) instead, as it is supported "
74− "by GNU and POSIX.1-2008.")));
72+ LIBBSD_DEPRECATED("This functions cannot be safely ported, "
73+ "use getline(3) instead, as it is supported "
74+ "by GNU and POSIX.1-2008.");
7575+#else
7676+char *fgetln(FILE *fp, size_t *lenp);
7777+#endif
@@ -519,17 +519,18 @@ index 462535a..e7eb46f 100644
519519+}
520520 #endif
521521diff --git a/src/funopen.c b/src/funopen.c
522−index 7d6ae31..9963162 100644
522+index 1e05c7e..ed8ce85 100644
523523--- a/src/funopen.c
524524+++ b/src/funopen.c
525−@@ -137,6 +137,7 @@ funopen(const void *cookie,
525+@@ -137,7 +137,7 @@ funopen(const void *cookie,
526526
527527 return fopencookie(cookiewrap, mode, funcswrap);
528528 }
529−+#elif defined(darwin) || defined(__APPLE__) || defined(MACOSX)
530− #else
531− #error "Function funopen() needs to be ported."
532− #endif
529+-#elif defined(__MUSL__)
530++#elif defined(__MUSL__) || defined(darwin) || defined(__APPLE__) || defined(MACOSX)
531+ /*
532+ * This is unimplementable on musl based systems, and upstream has stated
533+ * they will not add the needed support to implement it. Just ignore this
533534diff --git a/src/getentropy.c b/src/getentropy.c
534535index 3f11a1e..8a23a07 100644
535536--- a/src/getentropy.c
@@ -562,13 +563,13 @@ index 4f368a1..ab22fc1 100644
562563 #define SHA512_DIGEST_LENGTH 64
563564
564565diff --git a/src/hash/sha512c.c b/src/hash/sha512c.c
565−index c2a93be..f69013d 100644
566+index b3c8d5e..4fade0f 100644
566567--- a/src/hash/sha512c.c
567568+++ b/src/hash/sha512c.c
568−@@ -27,7 +27,11 @@
569− #include <sys/cdefs.h>
570− __FBSDID("$FreeBSD$");
569+@@ -25,7 +25,11 @@
570+ */
571571
572+ #include <sys/cdefs.h>
572573+#if defined(darwin) || defined(__APPLE__) || defined(MACOSX)
573574+#include <machine/endian.h>
574575+#else
@@ -578,24 +579,26 @@ index c2a93be..f69013d 100644
578579
579580 #include <string.h>
580581diff --git a/src/nlist.c b/src/nlist.c
581−index 0cffe55..f785b61 100644
582+index 0932f59..a3ba2be 100644
582583--- a/src/nlist.c
583584+++ b/src/nlist.c
584−@@ -27,6 +27,7 @@
585+@@ -27,6 +27,8 @@
585586 * SUCH DAMAGE.
586587 */
587588
588589+#if !defined(darwin) && !defined(__APPLE__) && !defined(MACOSX)
589− #if defined(LIBC_SCCS) && !defined(lint)
590− static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93";
591− #endif /* LIBC_SCCS and not lint */
592−@@ -409,3 +410,4 @@ elf_sym_to_nlist(struct nlist *nl, Elf_Sym *s, Elf_Shdr *shdr, int shnum)
593− nl->n_type |= N_EXT;
590++
591+ #include <sys/cdefs.h>
592+
593+ #include <sys/param.h>
594+@@ -265,3 +267,5 @@ nlist(const char *name, struct nlist *list)
595+ (void)close(fd);
596+ return (n);
594597 }
595− #endif /* _NLIST_DO_ELF */
598++
596599+#endif
597600diff --git a/src/setproctitle.c b/src/setproctitle.c
598−index c18c61c..b1b1591 100644
601+index 038ac7d..d0ef01b 100644
599602--- a/src/setproctitle.c
600603+++ b/src/setproctitle.c
601604@@ -32,6 +32,11 @@
@@ -626,42 +629,42 @@ index c18c61c..b1b1591 100644
626629 void setproctitle_stub(const char *fmt, ...)
627630 __attribute__((alias("setproctitle_impl")));
628631diff --git a/src/strlcat.c b/src/strlcat.c
629−index 21c8afb..e036132 100644
632+index 14c53a1..e01cb60 100644
630633--- a/src/strlcat.c
631634+++ b/src/strlcat.c
632635@@ -27,7 +27,11 @@
633− * If retval >= siz, truncation occurred.
636+ * If retval >= dsize, truncation occurred.
634637 */
635638 size_t
636639+#if defined(darwin) || defined(__APPLE__) || defined(MACOSX)
637−+bsd_strlcat(char *dst, const char *src, size_t siz)
640++bsd_strlcat(char *dst, const char *src, size_t dsize)
638641+#else
639− strlcat(char *dst, const char *src, size_t siz)
642+ strlcat(char *dst, const char *src, size_t dsize)
640643+#endif
641644 {
642− char *d = dst;
643− const char *s = src;
645+ const char *odst = dst;
646+ const char *osrc = src;
644647diff --git a/src/strlcpy.c b/src/strlcpy.c
645−index 1719d35..c63591d 100644
648+index e9a7fe4..10a855f 100644
646649--- a/src/strlcpy.c
647650+++ b/src/strlcpy.c
648651@@ -25,7 +25,11 @@
649− * Returns strlen(src); if retval >= siz, truncation occurred.
652+ * Returns strlen(src); if retval >= dsize, truncation occurred.
650653 */
651654 size_t
652655+#if defined(darwin) || defined(__APPLE__) || defined(MACOSX)
653−+bsd_strlcpy(char *dst, const char *src, size_t siz)
656++bsd_strlcpy(char *dst, const char *src, size_t dsize)
654657+#else
655− strlcpy(char *dst, const char *src, size_t siz)
658+ strlcpy(char *dst, const char *src, size_t dsize)
656659+#endif
657660 {
658− char *d = dst;
659− const char *s = src;
661+ const char *osrc = src;
662+ size_t nleft = dsize;
660663diff --git a/src/strmode.c b/src/strmode.c
661−index 8d825ae..c1b5f8d 100644
664+index e6afde5..c463243 100644
662665--- a/src/strmode.c
663666+++ b/src/strmode.c
664−@@ -37,7 +37,11 @@ static char sccsid[] = "@(#)strmode.c 8.3 (Berkeley) 8/15/94";
667+@@ -33,7 +33,11 @@
665668 #include <string.h>
666669
667670 void