Unverified Commit ae18887a authored by Aaron Andersen's avatar Aaron Andersen Committed by GitHub
Browse files

sysklogd: 1.5.1 -> 2.7.2, replace with maintained fork (#450725)

parents fea37ae1 dbac1d54
Loading
Loading
Loading
Loading
+0 −120
Original line number Diff line number Diff line
# this patch both fixes some include paths as well as removes glibc
# gates around defines that musl-libc also depends on.
diff -u sysklogd-1.5.1.orig/klogd.c sysklogd-1.5.1/klogd.c
--- sysklogd-1.5.1.orig/klogd.c	2014-10-04 15:47:18.000000000 -0400
+++ sysklogd-1.5.1/klogd.c	2021-01-18 23:09:23.000000000 -0500
@@ -260,11 +260,8 @@
 #include <unistd.h>
 #include <signal.h>
 #include <errno.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
 #include <sys/stat.h>
-#if !defined(__GLIBC__)
-#include <linux/time.h>
-#endif /* __GLIBC__ */
 #include <stdarg.h>
 #include <paths.h>
 #include <stdlib.h>
@@ -277,13 +274,8 @@
 
 #define __LIBRARY__
 #include <linux/unistd.h>
-#if !defined(__GLIBC__)
-# define __NR_ksyslog __NR_syslog
-_syscall3(int,ksyslog,int, type, char *, buf, int, len);
-#else
 #include <sys/klog.h>
 #define ksyslog klogctl
-#endif
 
 #define LOG_BUFFER_SIZE 4096
 #define LOG_LINE_LENGTH 1000
diff -u sysklogd-1.5.1.orig/ksym_mod.c sysklogd-1.5.1/ksym_mod.c
--- sysklogd-1.5.1.orig/ksym_mod.c	2014-10-04 15:47:18.000000000 -0400
+++ sysklogd-1.5.1/ksym_mod.c	2021-01-18 23:09:57.000000000 -0500
@@ -113,12 +113,9 @@
 #include <unistd.h>
 #include <signal.h>
 #include <errno.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
 #include <sys/stat.h>
 #include "module.h"
-#if !defined(__GLIBC__)
-#include <linux/time.h>
-#endif /* __GLIBC__ */
 #include <stdarg.h>
 #include <paths.h>
 #include <linux/version.h>
diff -u sysklogd-1.5.1.orig/pidfile.c sysklogd-1.5.1/pidfile.c
--- sysklogd-1.5.1.orig/pidfile.c	2014-10-04 15:47:18.000000000 -0400
+++ sysklogd-1.5.1/pidfile.c	2021-01-18 23:23:55.000000000 -0500
@@ -25,6 +25,7 @@
  */
 
 #include <stdio.h>
+#include <fcntl.h>
 #include <unistd.h>
 #include <sys/stat.h>
 #include <sys/file.h>
diff -u sysklogd-1.5.1.orig/syslog.c sysklogd-1.5.1/syslog.c
--- sysklogd-1.5.1.orig/syslog.c	2014-10-04 15:47:18.000000000 -0400
+++ sysklogd-1.5.1/syslog.c	2021-01-18 23:11:45.000000000 -0500
@@ -55,7 +55,6 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/file.h>
-#include <sys/signal.h>
 #include <sys/syslog.h>
 #if 0
 #include "syslog.h"
@@ -64,6 +63,8 @@
 
 #include <sys/uio.h>
 #include <sys/wait.h>
+#include <signal.h>
+#include <fcntl.h>
 #include <netdb.h>
 #include <string.h>
 #include <time.h>
diff -u sysklogd-1.5.1.orig/syslogd.c sysklogd-1.5.1/syslogd.c
--- sysklogd-1.5.1.orig/syslogd.c	2014-10-04 15:47:18.000000000 -0400
+++ sysklogd-1.5.1/syslogd.c	2021-01-18 23:13:25.000000000 -0500
@@ -519,9 +519,9 @@
 #include <time.h>
 
 #define SYSLOG_NAMES
+#include <errno.h>
 #include <sys/syslog.h>
 #include <sys/param.h>
-#include <sys/errno.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/wait.h>
@@ -818,9 +818,7 @@
 void init();
 void cfline(char *line, register struct filed *f);
 int decode(char *name, struct code *codetab);
-#if defined(__GLIBC__)
 #define dprintf mydprintf
-#endif /* __GLIBC__ */
 static void dprintf(char *, ...);
 static void allocate_log(void);
 void sighup_handler();
@@ -840,15 +838,9 @@
 	register char *p;
 #ifndef TESTING
 	ssize_t msglen;
-#endif
-#if !defined(__GLIBC__)
-	int len, num_fds;
-#else /* __GLIBC__ */
-#ifndef TESTING
 	socklen_t len;
 #endif
 	int num_fds;
-#endif /* __GLIBC__ */
 	/*
 	 * It took me quite some time to figure out how this is
 	 * supposed to work so I guess I should better write it down.
+21 −36
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchurl,
  fetchFromGitHub,
  autoreconfHook,
  pkg-config,
}:

stdenv.mkDerivation rec {
  pname = "sysklogd";
  version = "1.5.1";
  version = "2.7.2";

  src = fetchurl {
    url = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${version}.tar.gz";
    sha256 = "00f2wy6f0qng7qzga4iicyzl9j8b7mp6mrpfky5jxj93ms2w2rji";
  src = fetchFromGitHub {
    owner = "troglobit";
    repo = "sysklogd";
    rev = "v${version}";
    hash = "sha256-HwzqWZox5qc/TvCafx4XjA4njQhcHBS0gZthqPzONHk=";
  };

  patches = [
    ./systemd.patch
    ./union-wait.patch
    ./fix-includes-for-musl.patch
  nativeBuildInputs = [
    autoreconfHook
    pkg-config
  ];

  env.NIX_CFLAGS_COMPILE = "-DSYSV";

  installFlags = [
    "BINDIR=$(out)/sbin"
    "MANDIR=$(out)/share/man"
    "INSTALL=install"
  ];

  makeFlags = [
    "CC=${stdenv.cc.targetPrefix}cc"
  configureFlags = [
    "--sysconfdir=/etc"
    "--localstatedir=/var"
  ];

  postPatch = ''
    # Disable stripping during installation, stripping will be done anyway.
    # Fixes cross-compilation.
    substituteInPlace Makefile \
      --replace "-m 500 -s" "-m 500"
  '';

  preConfigure = ''
    sed -e 's@-o \''${MAN_USER} -g \''${MAN_GROUP} -m \''${MAN_PERMS} @@' -i Makefile
  '';

  preInstall = "mkdir -p $out/share/man/man5/ $out/share/man/man8/ $out/sbin";

  meta = with lib; {
    description = "System logging daemon";
    platforms = platforms.linux;
    license = licenses.gpl2Plus;
  meta = {
    description = "BSD syslog daemon with syslog()/syslogp() API replacement for Linux, RFC3164 + RFC5424";
    homepage = "https://github.com/troglobit/sysklogd";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ aanderse ];
    platforms = lib.subtractLists lib.platforms.darwin lib.platforms.unix;
  };
}
+0 −845

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −11
Original line number Diff line number Diff line
--- sysklogd-1.5-old/syslogd.c	2016-08-30 22:50:59.812926945 +0100
+++ sysklogd-1.5/syslogd.c	2016-08-30 22:51:12.008842890 +0100
@@ -2094,7 +2094,7 @@
 	(void) signal(SIGCHLD, reapchild);	/* reset signal handler -ASP */
 	wait ((int *)0);
 #else
-	union wait status;
+	int status;
 
 	while (wait3(&status, WNOHANG, (struct rusage *) NULL) > 0)
 		;