From 14942f3c48055b4bd12d55b2e45162d806a97ee2 Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Thu, 13 Feb 2020 11:34:51 +0300 Subject: runit: make it usable --- core/runit/patches/clearmem.patch | 12 +++++++ core/runit/patches/svlogd.patch | 14 ++++++++ core/runit/patches/utmpset-time_t.patch | 57 +++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 core/runit/patches/clearmem.patch create mode 100644 core/runit/patches/svlogd.patch create mode 100644 core/runit/patches/utmpset-time_t.patch (limited to 'core/runit/patches') diff --git a/core/runit/patches/clearmem.patch b/core/runit/patches/clearmem.patch new file mode 100644 index 00000000..2660c5f9 --- /dev/null +++ b/core/runit/patches/clearmem.patch @@ -0,0 +1,12 @@ +Taken from void +diff -Naur runit-2.1.2/src/svlogd.c runit-2.1.2/src/svlogd.c +--- runit-2.1.2/src/svlogd.c ++++ runit-2.1.2/src/svlogd.c +@@ -705,6 +705,7 @@ + coe(fdwdir); + dir =(struct logdir*)alloc(dirn *sizeof(struct logdir)); + if (! dir) die_nomem(); ++ memset(dir, 0, dirn * sizeof(struct logdir)); + for (i =0; i < dirn; ++i) { + dir[i].fddir =-1; dir[i].fdcur =-1; + dir[i].btmp =(char*)alloc(buflen *sizeof(char)); diff --git a/core/runit/patches/svlogd.patch b/core/runit/patches/svlogd.patch new file mode 100644 index 00000000..c43a228f --- /dev/null +++ b/core/runit/patches/svlogd.patch @@ -0,0 +1,14 @@ +Taken from void +Initialize all fields of sockaddr_in. +http://skarnet.org/cgi-bin/archive.cgi?2:mss:1163:201602:gpiglpbjdemlioaeabbn + +--- runit-2.1.2/src/svlogd.c ++++ runit-2.1.2/src/svlogd.c +@@ -430,6 +430,7 @@ + ld->name =(char*)fn; + ld->ppid =0; + ld->match ='+'; ++ ld->udpaddr.sin_family =AF_INET; + ld->udpaddr.sin_port =0; + ld->udponly =0; + while (! stralloc_copys(&ld->prefix, "")) pause_nomem(); diff --git a/core/runit/patches/utmpset-time_t.patch b/core/runit/patches/utmpset-time_t.patch new file mode 100644 index 00000000..9ccf6268 --- /dev/null +++ b/core/runit/patches/utmpset-time_t.patch @@ -0,0 +1,57 @@ +Taken from void +From 20a0afcd367666efc17c59cf121a0d991ff1bd09 Mon Sep 17 00:00:00 2001 +From: Gerrit Pape +Date: Thu, 31 Jul 2014 12:25:49 +0000 +Subject: [PATCH] utmpset.c: mixes "int32_t *" and "time_t *" + +Don't pass int32_t to time(), thx Lorenzo Beretta, +https://bugs.debian.org/754849 +--- + runit-2.1.2/src/utmpset.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/runit-2.1.2/src/utmpset.c b/runit-2.1.2/src/utmpset.c +index eea41a5..2e8a525 100644 +--- runit-2.1.2/src/utmpset.c ++++ runit-2.1.2/src/utmpset.c +@@ -24,6 +24,7 @@ void usage(void) { strerr_die4x(1, "usage: ", progname, USAGE, "\n"); } + int utmp_logout(const char *line) { + int fd; + uw_tmp ut; ++ time_t t; + int ok =-1; + + if ((fd =open(UW_TMP_UFILE, O_RDWR, 0)) < 0) +@@ -35,7 +36,8 @@ int utmp_logout(const char *line) { + if (!ut.ut_name[0] || (str_diff(ut.ut_line, line) != 0)) continue; + memset(ut.ut_name, 0, sizeof ut.ut_name); + memset(ut.ut_host, 0, sizeof ut.ut_host); +- if (time(&ut.ut_time) == -1) break; ++ if (time(&t) == -1) break; ++ ut.ut_time = t; + #ifdef DEAD_PROCESS + ut.ut_type =DEAD_PROCESS; + #endif +@@ -52,6 +54,7 @@ int wtmp_logout(const char *line) { + int len; + struct stat st; + uw_tmp ut; ++ time_t t; + + if ((fd = open_append(UW_TMP_WFILE)) == -1) + strerr_die4sys(111, FATAL, "unable to open ", UW_TMP_WFILE, ": "); +@@ -65,10 +68,11 @@ int wtmp_logout(const char *line) { + memset(&ut, 0, sizeof(uw_tmp)); + if ((len =str_len(line)) > sizeof ut.ut_line) len =sizeof ut.ut_line -2; + byte_copy(ut.ut_line, len, line); +- if (time(&ut.ut_time) == -1) { ++ if (time(&t) == -1) { + close(fd); + return(-1); + } ++ ut.ut_time = t; + #ifdef DEAD_PROCESS + ut.ut_type =DEAD_PROCESS; + #endif +-- +2.0.1 -- cgit v1.2.3