1# this patch both fixes some include paths as well as removes glibc
2# gates around defines that musl-libc also depends on.
3diff -u sysklogd-1.5.1.orig/klogd.c sysklogd-1.5.1/klogd.c
4--- sysklogd-1.5.1.orig/klogd.c 2014-10-04 15:47:18.000000000 -0400
5+++ sysklogd-1.5.1/klogd.c 2021-01-18 23:09:23.000000000 -0500
6@@ -260,11 +260,8 @@
7 #include <unistd.h>
8 #include <signal.h>
9 #include <errno.h>
10-#include <sys/fcntl.h>
11+#include <fcntl.h>
12 #include <sys/stat.h>
13-#if !defined(__GLIBC__)
14-#include <linux/time.h>
15-#endif /* __GLIBC__ */
16 #include <stdarg.h>
17 #include <paths.h>
18 #include <stdlib.h>
19@@ -277,13 +274,8 @@
20
21 #define __LIBRARY__
22 #include <linux/unistd.h>
23-#if !defined(__GLIBC__)
24-# define __NR_ksyslog __NR_syslog
25-_syscall3(int,ksyslog,int, type, char *, buf, int, len);
26-#else
27 #include <sys/klog.h>
28 #define ksyslog klogctl
29-#endif
30
31 #define LOG_BUFFER_SIZE 4096
32 #define LOG_LINE_LENGTH 1000
33diff -u sysklogd-1.5.1.orig/ksym_mod.c sysklogd-1.5.1/ksym_mod.c
34--- sysklogd-1.5.1.orig/ksym_mod.c 2014-10-04 15:47:18.000000000 -0400
35+++ sysklogd-1.5.1/ksym_mod.c 2021-01-18 23:09:57.000000000 -0500
36@@ -113,12 +113,9 @@
37 #include <unistd.h>
38 #include <signal.h>
39 #include <errno.h>
40-#include <sys/fcntl.h>
41+#include <fcntl.h>
42 #include <sys/stat.h>
43 #include "module.h"
44-#if !defined(__GLIBC__)
45-#include <linux/time.h>
46-#endif /* __GLIBC__ */
47 #include <stdarg.h>
48 #include <paths.h>
49 #include <linux/version.h>
50diff -u sysklogd-1.5.1.orig/pidfile.c sysklogd-1.5.1/pidfile.c
51--- sysklogd-1.5.1.orig/pidfile.c 2014-10-04 15:47:18.000000000 -0400
52+++ sysklogd-1.5.1/pidfile.c 2021-01-18 23:23:55.000000000 -0500
53@@ -25,6 +25,7 @@
54 */
55
56 #include <stdio.h>
57+#include <fcntl.h>
58 #include <unistd.h>
59 #include <sys/stat.h>
60 #include <sys/file.h>
61diff -u sysklogd-1.5.1.orig/syslog.c sysklogd-1.5.1/syslog.c
62--- sysklogd-1.5.1.orig/syslog.c 2014-10-04 15:47:18.000000000 -0400
63+++ sysklogd-1.5.1/syslog.c 2021-01-18 23:11:45.000000000 -0500
64@@ -55,7 +55,6 @@
65 #include <sys/types.h>
66 #include <sys/socket.h>
67 #include <sys/file.h>
68-#include <sys/signal.h>
69 #include <sys/syslog.h>
70 #if 0
71 #include "syslog.h"
72@@ -64,6 +63,8 @@
73
74 #include <sys/uio.h>
75 #include <sys/wait.h>
76+#include <signal.h>
77+#include <fcntl.h>
78 #include <netdb.h>
79 #include <string.h>
80 #include <time.h>
81diff -u sysklogd-1.5.1.orig/syslogd.c sysklogd-1.5.1/syslogd.c
82--- sysklogd-1.5.1.orig/syslogd.c 2014-10-04 15:47:18.000000000 -0400
83+++ sysklogd-1.5.1/syslogd.c 2021-01-18 23:13:25.000000000 -0500
84@@ -519,9 +519,9 @@
85 #include <time.h>
86
87 #define SYSLOG_NAMES
88+#include <errno.h>
89 #include <sys/syslog.h>
90 #include <sys/param.h>
91-#include <sys/errno.h>
92 #include <sys/ioctl.h>
93 #include <sys/stat.h>
94 #include <sys/wait.h>
95@@ -818,9 +818,7 @@
96 void init();
97 void cfline(char *line, register struct filed *f);
98 int decode(char *name, struct code *codetab);
99-#if defined(__GLIBC__)
100 #define dprintf mydprintf
101-#endif /* __GLIBC__ */
102 static void dprintf(char *, ...);
103 static void allocate_log(void);
104 void sighup_handler();
105@@ -840,15 +838,9 @@
106 register char *p;
107 #ifndef TESTING
108 ssize_t msglen;
109-#endif
110-#if !defined(__GLIBC__)
111- int len, num_fds;
112-#else /* __GLIBC__ */
113-#ifndef TESTING
114 socklen_t len;
115 #endif
116 int num_fds;
117-#endif /* __GLIBC__ */
118 /*
119 * It took me quite some time to figure out how this is
120 * supposed to work so I guess I should better write it down.