0

Initial commit

This commit is contained in:
eleksir
2023-11-19 18:01:40 +03:00
commit 80ec8a7529
586 changed files with 29486 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
From 20a0afcd367666efc17c59cf121a0d991ff1bd09 Mon Sep 17 00:00:00 2001
From: Gerrit Pape <pape@smarden.org>
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
--- a/runit-2.1.2/src/utmpset.c
+++ b/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

View File

@@ -0,0 +1,21 @@
Description: Make buildsystem respect dpkg-buildflags
Author: Dmitry Bogatov <KAction@gnu.org>
Last-Update: 2016-06-01
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/runit-2.1.2/src/print-cc.sh
+++ b/runit-2.1.2/src/print-cc.sh
@@ -2,4 +2,4 @@ cc="`head -n1 conf-cc`"
systype="`cat systype`"
cat warn-auto.sh
-echo exec "$cc" '-c ${1+"$@"}'
+echo exec "$cc" "$CPPFLAGS" "$CFLAGS" '-c ${1+"$@"}'
--- a/runit-2.1.2/src/print-ld.sh
+++ b/runit-2.1.2/src/print-ld.sh
@@ -3,4 +3,4 @@ systype="`cat systype`"
cat warn-auto.sh
echo 'main="$1"; shift'
-echo exec "$ld" '-o "$main" "$main".o ${1+"$@"}'
+echo exec "$ld" "$LDFLAGS" '-o "$main" "$main".o ${1+"$@"}'

View File

@@ -0,0 +1,77 @@
Description: Move communication files under /run
Runit by default uses files /etc/runit/stop and /etc/runit/reboot.
This configuration will not work when /etc is mounted read-only,
as such this patch renames this files into /run/runit.stop and
/run/runit.reboot
Author: Dmitry Bogatov <KAction@gnu.org>
Last-Update: 2016-06-02
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/runit-2.1.2/etc/debian/1
+++ b/runit-2.1.2/etc/debian/1
@@ -6,5 +6,5 @@ PATH=/command:/sbin:/bin:/usr/sbin:/usr/
/etc/init.d/rcS
/etc/init.d/rmnologin
-touch /etc/runit/stopit
-chmod 0 /etc/runit/stopit
+touch /run/runit.stopit
+chmod 0 /run/runit.stopit
--- a/runit-2.1.2/etc/debian/3
+++ b/runit-2.1.2/etc/debian/3
@@ -4,7 +4,7 @@ exec 2>&1
PATH=/command:/sbin:/bin:/usr/sbin:/usr/bin
LAST=0
-test -x /etc/runit/reboot && LAST=6
+test -x /run/runit.reboot && LAST=6
echo 'Waiting for services to stop...'
sv -w196 force-stop /service/*
--- a/runit-2.1.2/etc/debian/ctrlaltdel
+++ b/runit-2.1.2/etc/debian/ctrlaltdel
@@ -4,6 +4,6 @@ PATH=/bin:/usr/bin
MSG="System is going down in 14 seconds..."
# echo 'disabled.' ; exit
-touch /etc/runit/stopit
-chmod 100 /etc/runit/stopit && echo "$MSG" | wall
+touch /etc/runit.stopit
+chmod 100 /etc/runit.stopit && echo "$MSG" | wall
/bin/sleep 14
--- a/runit-2.1.2/man/runit-init.8
+++ b/runit-2.1.2/man/runit-init.8
@@ -26,9 +26,9 @@ To signal
the system halt request,
.B runit-init
removes all permissions of the file
-.I /etc/runit/reboot
+.I /run/runit.reboot
(chmod 0), and sets the execute by owner permission of the file
-.I /etc/runit/stopit
+.I /run/runit.stopit
(chmod 100).
Then a CONT signal is sent to
.BR runit (8).
@@ -40,9 +40,9 @@ To signal
the system reboot request,
.B runit-init
sets the execute by owner permission of the files
-.I /etc/runit/reboot
+.I /run/runit.reboot
and
-.I /etc/runit/stopit
+.I /run/runit.stopit
(chmod 100). Then a CONT signal is sent to
.BR runit (8).
.SH EXIT CODES
--- a/runit-2.1.2/src/runit.h
+++ b/runit-2.1.2/src/runit.h
@@ -1,5 +1,5 @@
#define RUNIT "/sbin/runit"
-#define STOPIT "/etc/runit/stopit"
-#define REBOOT "/etc/runit/reboot"
+#define STOPIT "/run/runit.stopit"
+#define REBOOT "/run/runit.reboot"
#define NOSYNC "/run/runit.nosync"
#define CTRLALTDEL "/etc/runit/ctrlaltdel"

View File

@@ -0,0 +1,20 @@
Description: Emulalate sysv runlevel 5 by default
Currently, not many daemons in Debian provides proper runscripts, so
if user switches to runit, she will on next reboot, that none of daemons,
including essential, like cron, are started.
.
This patch starts them in sysv-init style -- unmanaged, in background.
It is sub-par solution, but allows one-by-one transition.
Author: Dmitry Bogatov
Forwarded: not-needed
Last-Update: 2016-06-09
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/runit-2.1.2/etc/debian/1
+++ b/runit-2.1.2/etc/debian/1
@@ -8,3 +8,5 @@ PATH=/command:/sbin:/bin:/usr/sbin:/usr/
touch /run/runit.stopit
chmod 0 /run/runit.stopit
+
+[ -e /etc/runit/no-emulate-sysv ] || /etc/init.d/rc 5

View File

@@ -0,0 +1,18 @@
commit e0f48258bb2ff9f65524530771d4f6f4b2948384
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun Aug 16 15:12:35 2020 -0300
svlogd.c: Clear dir struct.
diff --git a/src/svlogd.c b/src/svlogd.c
index 5e55a90..006493e 100644
--- a/runit-2.1.2/src/svlogd.c
+++ b/runit-2.1.2/src/svlogd.c
@@ -705,6 +705,7 @@ int main(int argc, const char **argv) {
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));

View File

@@ -0,0 +1,20 @@
commit 4d2a8e66a3c62f47ca7b9e91c49afbeaa0cfc0b1
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun Aug 16 15:12:45 2020 -0300
svlogd.c: Initialize all fields of sockaddr_in.
http://skarnet.org/cgi-bin/archive.cgi?2:mss:1163:201602:gpiglpbjdemlioaeabbn
diff --git a/src/svlogd.c b/src/svlogd.c
index 006493e..8de65e0 100644
--- a/runit-2.1.2/src/svlogd.c
+++ b/runit-2.1.2/src/svlogd.c
@@ -430,6 +430,7 @@ unsigned int logdir_open(struct logdir *ld, const char *fn) {
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();

View File

@@ -0,0 +1,18 @@
commit ec0f605d5b385c6c230a10312697315e01dad217
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun Aug 16 15:19:37 2020 -0300
svlogd.c: add missing header.
diff --git a/src/svlogd.c b/src/svlogd.c
index 8de65e0..8c68c73 100644
--- a/runit-2.1.2/src/svlogd.c
+++ b/runit-2.1.2/src/svlogd.c
@@ -8,6 +8,7 @@
#include <dirent.h>
#include <unistd.h>
#include <stdio.h>
+#include <string.h>
#include "pmatch.h"
#include "fmt_ptime.h"
#include "alloc.h"

View File

@@ -0,0 +1,18 @@
commit 53bf22e68c36b2fc2281998f8311c7c73c17259c
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun Aug 16 15:19:45 2020 -0300
seek_set.c: add missing header.
diff --git a/src/seek_set.c b/src/seek_set.c
index 19b8265..a1a36d0 100644
--- a/runit-2.1.2/src/seek_set.c
+++ b/runit-2.1.2/src/seek_set.c
@@ -1,6 +1,7 @@
/* Public domain. */
#include <sys/types.h>
+#include <unistd.h>
#include "seek.h"
#define SET 0 /* sigh */

View File

@@ -0,0 +1,17 @@
commit 3295cb4865759a71c27ca5fe4ade980c8b69db6c
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun Aug 16 15:19:51 2020 -0300
pathexec_run.c:: add missing header.
diff --git a/src/pathexec_run.c b/src/pathexec_run.c
index 1770ac7..70ac7a8 100644
--- a/runit-2.1.2/src/pathexec_run.c
+++ b/runit-2.1.2/src/pathexec_run.c
@@ -1,5 +1,6 @@
/* Public domain. */
+#include <unistd.h>
#include "error.h"
#include "stralloc.h"
#include "str.h"

View File

@@ -0,0 +1,23 @@
commit c3c65bcdfe53aac4f1bd27f4bfb3faccabfa2fd3
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun Aug 16 15:19:57 2020 -0300
chkshsgr.c: use gid_t.
diff --git a/src/chkshsgr.c b/src/chkshsgr.c
index 38c352d..31eda67 100644
--- a/runit-2.1.2/src/chkshsgr.c
+++ b/runit-2.1.2/src/chkshsgr.c
@@ -1,10 +1,11 @@
/* Public domain. */
+#include <sys/types.h>
#include <unistd.h>
int main()
{
- short x[4];
+ gid_t x[4];
x[0] = x[1] = 0;
if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1);

View File

@@ -0,0 +1,48 @@
commit fc2f8674d726df289e650b79189c4221ff66c8a5
Author: Érico Rolim <erico.erc@gmail.com>
Date: Sun Aug 16 15:20:03 2020 -0300
prot.c, prot.h: use gid_t and uid_t.
diff --git a/src/prot.c b/src/prot.c
index 79a88c5..66cdc05 100644
--- a/runit-2.1.2/src/prot.c
+++ b/runit-2.1.2/src/prot.c
@@ -3,7 +3,11 @@
#include "hasshsgr.h"
#include "prot.h"
-int prot_gid(int gid)
+#include <sys/types.h>
+#include <unistd.h>
+#include <grp.h>
+
+int prot_gid(gid_t gid)
{
#ifdef HASSHORTSETGROUPS
short x[2];
@@ -15,7 +19,7 @@ int prot_gid(int gid)
return setgid(gid); /* _should_ be redundant, but on some systems it isn't */
}
-int prot_uid(int uid)
+int prot_uid(uid_t uid)
{
return setuid(uid);
}
diff --git a/src/prot.h b/src/prot.h
index 2e5cb81..b9fa6c8 100644
--- a/runit-2.1.2/src/prot.h
+++ b/runit-2.1.2/src/prot.h
@@ -3,7 +3,9 @@
#ifndef PROT_H
#define PROT_H
-extern int prot_gid(int);
-extern int prot_uid(int);
+#include <sys/types.h>
+
+extern int prot_gid(gid_t);
+extern int prot_uid(uid_t);
#endif

View File

@@ -0,0 +1,24 @@
commit 727b2a5236346e75ec6455179d5073e348d165be (HEAD -> refs/heads/master, refs/remotes/origin/master, refs/remotes/origin/HEAD)
Author: Érico Rolim <erico.erc@gmail.com>
Date: Wed Aug 26 21:00:34 2020 -0300
chpst: fix undefined operation on sequence point.
Based on patch from
https://salsa.debian.org/debian/runit/-/blob/77a49befd7c1a08bfe0613454e540562529811fa/debian/patches/0016-fix-warning-for-undefined-operation-on-sequence-poin.patch
diff --git a/src/chpst.c b/src/chpst.c
index f279d44..1cca5f4 100644
--- a/runit-2.1.2/src/chpst.c
+++ b/runit-2.1.2/src/chpst.c
@@ -308,7 +308,8 @@ int main(int argc, const char **argv) {
case 'n':
switch (*optarg) {
case '-':
- if (optarg[scan_ulong(++optarg, &ul)]) usage(); nicelvl =ul;
+ ++optarg;
+ if (optarg[scan_ulong(optarg, &ul)]) usage(); nicelvl =ul;
nicelvl *=-1;
break;
case '+': ++optarg;

View File

@@ -0,0 +1,25 @@
From 8a090ee97d4037ed19fc468ce2933db8cb264016 Mon Sep 17 00:00:00 2001
From: Jan <cloux@rote.ch>
Date: Sun, 26 Jan 2020 13:39:52 +0100
Subject: [PATCH] fix: runsvdir.c event check
- fix runsvdir: wrong operator in event check, should be 'and' instead of 'or'.
This is a common typo. The IOPAUSE_READ is not being checked and the condition
always wrongly evaluates to true.
---
runit-2.1.2/src/runsvdir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/runit-2.1.2/src/runsvdir.c b/runit-2.1.2/src/runsvdir.c
index 1317fe9..aca22d0 100644
--- a/runit-2.1.2/src/runsvdir.c
+++ b/runit-2.1.2/src/runsvdir.c
@@ -265,7 +265,7 @@ int main(int argc, char **argv) {
iopause(0, 0, &deadline, &now);
sig_unblock(sig_child);
- if (rplog && (io[0].revents | IOPAUSE_READ))
+ if (rplog && (io[0].revents & IOPAUSE_READ))
while (read(logpipe[0], &ch, 1) > 0)
if (ch) {
for (i =6; i < rploglen; i++)

View File

@@ -0,0 +1,89 @@
From 62031255f6e7f6ef0355c81010bb193153267485 Mon Sep 17 00:00:00 2001
From: Jan <cloux@rote.ch>
Date: Fri, 8 Mar 2019 21:18:35 +0100
Subject: [PATCH] fix: resource leaks and other issues as reported by infer
to run infer static code analyzer (fbinfer.com):
cd src; infer run -- make
- fix: fd_move.c resource leak - close file handle
- fix: runit-init.c resource leak - close file handle
- fix: svlogd.c dead storage - value never used
- fix: x86cpuid.c uninitialized value read
- fix: package/install-man - do not use unreliable symlinks
---
runit-2.1.2/package/install-man | 11 +++--------
runit-2.1.2/src/fd_move.c | 5 ++++-
runit-2.1.2/src/runit-init.c | 6 +++---
runit-2.1.2/src/svlogd.c | 2 +-
runit-2.1.2/src/x86cpuid.c | 4 ++++
5 files changed, 15 insertions(+), 13 deletions(-)
diff -ruNp admin/runit-2.1.2/src/fd_move.c admin.new/runit-2.1.2/src/fd_move.c
--- admin/runit-2.1.2/src/fd_move.c 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/src/fd_move.c 2020-11-04 16:04:06.064942243 +0300
@@ -6,7 +6,10 @@
int fd_move(int to,int from)
{
if (to == from) return 0;
- if (fd_copy(to,from) == -1) return -1;
+ if (fd_copy(to,from) == -1) {
+ close(from);
+ return -1;
+ }
close(from);
return 0;
}
diff -ruNp admin/runit-2.1.2/src/runit-init.c admin.new/runit-2.1.2/src/runit-init.c
--- admin/runit-2.1.2/src/runit-init.c 2014-08-10 22:22:34.000000000 +0400
+++ admin.new/runit-2.1.2/src/runit-init.c 2020-11-04 16:04:06.065942238 +0300
@@ -17,7 +17,7 @@ const char *progname;
void usage(void) { strerr_die4x(0, "usage: ", progname, USAGE, "\n"); }
void runit_halt () {
- if (open_trunc(STOPIT) == -1)
+ if (close(open_trunc(STOPIT)) == -1)
strerr_die4sys(111, FATAL, "unable to create ", STOPIT, ": ");
if (chmod(STOPIT, 0100) == -1)
strerr_die4sys(111, FATAL, "unable to chmod ", STOPIT, ": ");
@@ -29,11 +29,11 @@ void runit_halt () {
}
void runit_reboot () {
- if (open_trunc(STOPIT) == -1)
+ if (close(open_trunc(STOPIT)) == -1)
strerr_die4sys(111, FATAL, "unable to create ", STOPIT, ": ");
if (chmod(STOPIT, 0100) == -1)
strerr_die4sys(111, FATAL, "unable to chmod ", STOPIT, ": ");
- if (open_trunc(REBOOT) == -1)
+ if (close(open_trunc(REBOOT)) == -1)
strerr_die4sys(111, FATAL, "unable to create ", REBOOT, ": ");
if (chmod(REBOOT, 0100) == -1)
strerr_die4sys(111, FATAL, "unable to chmod ", REBOOT, ": ");
diff -ruNp admin/runit-2.1.2/src/svlogd.c admin.new/runit-2.1.2/src/svlogd.c
--- admin/runit-2.1.2/src/svlogd.c 2014-08-10 22:22:34.000000000 +0400
+++ admin.new/runit-2.1.2/src/svlogd.c 2020-11-04 16:06:23.526311748 +0300
@@ -396,7 +396,8 @@ unsigned int ip4_scan(const char *s,char
if (*s != '.') return 0; ++s; ++len;
i = scan_ulong(s,&u); if (!i) return 0; ip[2] = u; s += i; len += i;
if (*s != '.') return 0; ++s; ++len;
- i = scan_ulong(s,&u); if (!i) return 0; ip[3] = u; s += i; len += i;
+ i = scan_ulong(s,&u); if (!i) return 0; ip[3] = u; len += i;
+
return len;
}
diff -ruNp admin/runit-2.1.2/src/x86cpuid.c admin.new/runit-2.1.2/src/x86cpuid.c
--- admin/runit-2.1.2/src/x86cpuid.c 2014-08-10 22:22:34.000000000 +0400
+++ admin.new/runit-2.1.2/src/x86cpuid.c 2020-11-04 16:04:06.067942229 +0300
@@ -21,6 +21,10 @@ int main()
x[1] = 0;
x[2] = 0;
x[3] = 0;
+ y[0] = 0;
+ y[1] = 0;
+ y[2] = 0;
+ y[3] = 0;
asm volatile(".byte 15;.byte 162" : "=a"(x[0]),"=b"(x[1]),"=c"(x[3]),"=d"(x[2]) : "0"(0) );
if (!x[0]) return 0;

View File

@@ -0,0 +1,40 @@
From f7b8f943d1f7a8f26df8d81eeb0a2d5a69ee7e22 Mon Sep 17 00:00:00 2001
From: Jan <cloux@rote.ch>
Date: Wed, 6 Mar 2019 18:38:04 +0100
Subject: [PATCH] fix: replace obsolete usleep with nanosleep
POSIX.1-2001 declares usleep obsolete,
POSIX.1-2008 removes the specification of usleep,
see https://linux.die.net/man/3/usleep
---
runit-2.1.2/src/sv.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/runit-2.1.2/src/sv.c b/runit-2.1.2/src/sv.c
index 6cc2a8b..f97c5a2 100644
--- a/runit-2.1.2/src/sv.c
+++ b/runit-2.1.2/src/sv.c
@@ -1,5 +1,6 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <time.h>
#include <unistd.h>
#include "str.h"
#include "strerr.h"
@@ -271,6 +272,7 @@ int control(char *a) {
int main(int argc, char **argv) {
unsigned int i, done;
char *x;
+ const struct timespec sleeptime = {0, 420000000};
progname =*argv;
for (i =str_len(*argv); i; --i) if ((*argv)[i -1] == '/') break;
@@ -388,7 +390,7 @@ int main(int argc, char **argv) {
fatal("unable to change to original directory");
}
if (done) break;
- usleep(420000);
+ nanosleep(&sleeptime, NULL);
taia_now(&tnow);
}
return(rc > 99 ? 99 : rc);

View File

@@ -0,0 +1,294 @@
diff -ruNp admin/runit-2.1.2/src/chkshsgr.c admin.new/runit-2.1.2/src/chkshsgr.c
--- admin/runit-2.1.2/src/chkshsgr.c 2020-11-04 16:53:26.482378214 +0300
+++ admin.new/runit-2.1.2/src/chkshsgr.c 2020-11-04 16:55:36.400785552 +0300
@@ -2,6 +2,7 @@
#include <sys/types.h>
#include <unistd.h>
+#include <grp.h>
int main()
{
diff -ruNp admin/runit-2.1.2/src/chpst.c admin.new/runit-2.1.2/src/chpst.c
--- admin/runit-2.1.2/src/chpst.c 2020-11-04 16:53:35.608336583 +0300
+++ admin.new/runit-2.1.2/src/chpst.c 2020-11-04 16:57:34.848244408 +0300
@@ -3,6 +3,7 @@
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
+#include <grp.h>
#include "sgetopt.h"
#include "error.h"
#include "strerr.h"
@@ -40,7 +41,7 @@ void usage() { strerr_die4x(100, "usage:
char *set_user =0;
char *env_user =0;
-const char *argv0 =0;
+char *argv0 =0;
const char *env_dir =0;
unsigned int verbose =0;
unsigned int pgrp =0;
@@ -258,14 +259,14 @@ void slimit() {
}
/* argv[0] */
-void setuidgid(int, const char *const *);
-void envuidgid(int, const char *const *);
-void envdir(int, const char *const *);
-void pgrphack(int, const char *const *);
-void setlock(int, const char *const *);
-void softlimit(int, const char *const *);
+void setuidgid(int, char *const *);
+void envuidgid(int, char *const *);
+void envdir(int, char *const *);
+void pgrphack(int, char *const *);
+void setlock(int, char *const *);
+void softlimit(int, char *const *);
-int main(int argc, const char **argv) {
+int main(int argc, char **argv) {
int opt;
int i;
unsigned long ul;
@@ -367,7 +368,7 @@ int main(int argc, const char **argv) {
void setuidgid_usage() {
strerr_die4x(100, "usage: ", progname, USAGE_SETUIDGID, "\n");
}
-void setuidgid(int argc, const char *const *argv) {
+void setuidgid(int argc, char *const *argv) {
const char *account;
if (! (account =*++argv)) setuidgid_usage();
@@ -380,7 +381,7 @@ void setuidgid(int argc, const char *con
void envuidgid_usage() {
strerr_die4x(100, "usage: ", progname, USAGE_ENVUIDGID, "\n");
}
-void envuidgid(int argc, const char *const *argv) {
+void envuidgid(int argc, char *const *argv) {
const char *account;
if (! (account =*++argv)) envuidgid_usage();
@@ -393,7 +394,7 @@ void envuidgid(int argc, const char *con
void envdir_usage() {
strerr_die4x(100, "usage: ", progname, USAGE_ENVDIR, "\n");
}
-void envdir(int argc, const char *const *argv) {
+void envdir(int argc, char *const *argv) {
const char *dir;
if (! (dir =*++argv)) envdir_usage();
@@ -406,7 +407,7 @@ void envdir(int argc, const char *const
void pgrphack_usage() {
strerr_die4x(100, "usage: ", progname, USAGE_PGRPHACK, "\n");
}
-void pgrphack(int argc, const char *const *argv) {
+void pgrphack(int argc, char *const *argv) {
if (! *++argv) pgrphack_usage();
setsid();
pathexec(argv);
@@ -416,7 +417,7 @@ void pgrphack(int argc, const char *cons
void setlock_usage() {
strerr_die4x(100, "usage: ", progname, USAGE_SETLOCK, "\n");
}
-void setlock(int argc, const char *const *argv) {
+void setlock(int argc, char *const *argv) {
int opt;
unsigned int delay =0;
unsigned int x =0;
@@ -450,7 +451,7 @@ void getlarg(long *l) {
if (optarg[scan_ulong(optarg, &ul)]) usage();
*l =ul;
}
-void softlimit(int argc, const char *const *argv) {
+void softlimit(int argc, char *const *argv) {
int opt;
while ((opt =getopt(argc,argv,"a:c:d:f:l:m:o:p:r:s:t:")) != opteof)
diff -ruNp admin/runit-2.1.2/src/pathexec.h admin.new/runit-2.1.2/src/pathexec.h
--- admin/runit-2.1.2/src/pathexec.h 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/src/pathexec.h 2020-11-04 16:54:40.572040232 +0300
@@ -3,9 +3,9 @@
#ifndef PATHEXEC_H
#define PATHEXEC_H
-extern void pathexec_run(const char *,const char * const *,const char * const *);
+extern void pathexec_run(const char *, char *const *, char *const *);
extern int pathexec_env(const char *,const char *);
-extern void pathexec_env_run(const char *, const char * const *);
-extern void pathexec(const char * const *);
+extern void pathexec_env_run(const char *, char *const *);
+extern void pathexec(char * const *);
#endif
diff -ruNp admin/runit-2.1.2/src/pathexec_env.c admin.new/runit-2.1.2/src/pathexec_env.c
--- admin/runit-2.1.2/src/pathexec_env.c 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/src/pathexec_env.c 2020-11-04 16:54:40.573040227 +0300
@@ -22,9 +22,9 @@ int pathexec_env(const char *s,const cha
return stralloc_cat(&plus,&tmp);
}
-void pathexec_env_run(const char *file, const char *const *argv)
+void pathexec_env_run(const char *file, char *const *argv)
{
- const char **e;
+ char **e;
unsigned int elen;
unsigned int i;
unsigned int j;
@@ -40,7 +40,7 @@ void pathexec_env_run(const char *file,
if (!plus.s[i])
++elen;
- e = (const char **) alloc((elen + 1) * sizeof(char *));
+ e = (char **) alloc((elen + 1) * sizeof(char *));
if (!e) return;
elen = 0;
@@ -68,7 +68,7 @@ void pathexec_env_run(const char *file,
alloc_free(e);
}
-void pathexec(const char *const *argv)
+void pathexec(char *const *argv)
{
return pathexec_env_run(*argv, argv);
}
diff -ruNp admin/runit-2.1.2/src/pathexec_run.c admin.new/runit-2.1.2/src/pathexec_run.c
--- admin/runit-2.1.2/src/pathexec_run.c 2020-11-04 16:53:22.330397154 +0300
+++ admin.new/runit-2.1.2/src/pathexec_run.c 2020-11-04 16:54:42.135033101 +0300
@@ -9,7 +9,7 @@
static stralloc tmp;
-void pathexec_run(const char *file,const char * const *argv,const char * const *envp)
+void pathexec_run(const char *file, char *const *argv, char *const *envp)
{
const char *path;
unsigned int split;
diff -ruNp admin/runit-2.1.2/src/prot.c admin.new/runit-2.1.2/src/prot.c
--- admin/runit-2.1.2/src/prot.c 2020-11-04 16:53:30.775358630 +0300
+++ admin.new/runit-2.1.2/src/prot.c 2020-11-04 16:59:33.850699916 +0300
@@ -10,7 +10,7 @@
int prot_gid(gid_t gid)
{
#ifdef HASSHORTSETGROUPS
- short x[2];
+ gid_t x[2];
x[0] = gid; x[1] = 73; /* catch errors */
if (setgroups(1,x) == -1) return -1;
#else
diff -ruNp admin/runit-2.1.2/src/runsvdir.c admin.new/runit-2.1.2/src/runsvdir.c
--- admin/runit-2.1.2/src/runsvdir.c 2020-11-04 16:53:40.102316083 +0300
+++ admin.new/runit-2.1.2/src/runsvdir.c 2020-11-04 16:54:50.376995503 +0300
@@ -63,7 +63,7 @@ void runsv(int no, char *name) {
}
if (pid == 0) {
/* child */
- const char *prog[3];
+ char *prog[3];
prog[0] ="runsv";
prog[1] =name;
@@ -71,7 +71,7 @@ void runsv(int no, char *name) {
sig_uncatch(sig_hangup);
sig_uncatch(sig_term);
if (pgrp) setsid();
- pathexec_run(*prog, prog, (const char* const*)environ);
+ pathexec_run(*prog, prog, (char * const *)environ);
fatal("unable to start runsv ", name);
}
sv[no].pid =pid;
diff -ruNp admin/runit-2.1.2/src/sgetopt.c admin.new/runit-2.1.2/src/sgetopt.c
--- admin/runit-2.1.2/src/sgetopt.c 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/src/sgetopt.c 2020-11-04 16:54:52.310986681 +0300
@@ -27,7 +27,7 @@ Documentation in sgetopt.3.
int opterr = 1;
const char *optprogname = 0;
-int getopt(int argc,const char *const *argv,const char *opts)
+int getopt(int argc,char *const *argv,const char *opts)
{
int c;
const char *s;
diff -ruNp admin/runit-2.1.2/src/sgetopt.h admin.new/runit-2.1.2/src/sgetopt.h
--- admin/runit-2.1.2/src/sgetopt.h 2014-08-10 22:22:34.000000000 +0400
+++ admin.new/runit-2.1.2/src/sgetopt.h 2020-11-04 16:54:52.311986676 +0300
@@ -16,7 +16,7 @@
#include "subgetopt.h"
-extern int sgetoptmine(int,const char *const *,const char *);
+extern int sgetoptmine(int,char *const *,const char *);
extern int sgetopterr;
extern const char *sgetoptprogname;
diff -ruNp admin/runit-2.1.2/src/subgetopt.c admin.new/runit-2.1.2/src/subgetopt.c
--- admin/runit-2.1.2/src/subgetopt.c 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/src/subgetopt.c 2020-11-04 16:54:52.312986672 +0300
@@ -16,7 +16,7 @@ const char *optarg = 0;
int optproblem = 0;
int optdone = SUBGETOPTDONE;
-int sgopt(int argc,const char *const *argv,const char *opts)
+int sgopt(int argc,char *const *argv,const char *opts)
{
int c;
const char *s;
diff -ruNp admin/runit-2.1.2/src/subgetopt.h admin.new/runit-2.1.2/src/subgetopt.h
--- admin/runit-2.1.2/src/subgetopt.h 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/src/subgetopt.h 2020-11-04 16:54:52.312986672 +0300
@@ -15,7 +15,7 @@
#define SUBGETOPTDONE -1
-extern int subgetopt(int,const char *const *,const char *);
+extern int subgetopt(int,char *const *,const char *);
extern const char *subgetoptarg;
extern int subgetoptind;
extern int subgetoptpos;
diff -ruNp admin/runit-2.1.2/src/sv.c admin.new/runit-2.1.2/src/sv.c
--- admin/runit-2.1.2/src/sv.c 2020-11-04 16:53:54.756249234 +0300
+++ admin.new/runit-2.1.2/src/sv.c 2020-11-04 16:54:54.886974929 +0300
@@ -283,7 +283,7 @@ int main(int argc, char **argv) {
lsb =(str_diff(progname, "sv"));
if ((x =env_get("SVDIR"))) varservice =x;
if ((x =env_get("SVWAIT"))) scan_ulong(x, &wait);
- while ((i =getopt(argc, (const char* const*)argv, "w:vV")) != opteof) {
+ while ((i =getopt(argc, (char* const*)argv, "w:vV")) != opteof) {
switch(i) {
case 'w': scan_ulong(optarg, &wait);
case 'v': verbose =1; break;
diff -ruNp admin/runit-2.1.2/src/svlogd.c admin.new/runit-2.1.2/src/svlogd.c
--- admin/runit-2.1.2/src/svlogd.c 2020-11-04 16:53:47.389282841 +0300
+++ admin.new/runit-2.1.2/src/svlogd.c 2020-11-04 16:54:56.968965432 +0300
@@ -53,7 +53,7 @@ unsigned long linelen;
const char *replace ="";
char repl =0;
-const char **fndir;
+char **fndir;
int fdwdir;
struct stat st;
stralloc sa;
@@ -664,7 +664,7 @@ void logmatch(struct logdir *ld) {
i +=byte_chr(&ld->inst.s[i], ld->inst.len -i, 0);
}
}
-int main(int argc, const char **argv) {
+int main(int argc, char **argv) {
int i;
int opt;
diff -ruNp admin/runit-2.1.2/src/utmpset.c admin.new/runit-2.1.2/src/utmpset.c
--- admin/runit-2.1.2/src/utmpset.c 2020-11-04 16:52:29.062640152 +0300
+++ admin.new/runit-2.1.2/src/utmpset.c 2020-11-04 16:54:59.851952280 +0300
@@ -85,7 +85,7 @@ int wtmp_logout(const char *line) {
return(1);
}
-int main (int argc, const char * const *argv, const char * const *envp) {
+int main (int argc, char * const *argv, char * const *envp) {
int opt;
int wtmp =0;

View File

@@ -0,0 +1,22 @@
From 7791b76917a00ca44e3a5c297675214a40f7f215 Mon Sep 17 00:00:00 2001
From: Dmitry Bogatov <KAction@gnu.org>
Date: Mon, 28 May 2018 21:46:39 +0300
Subject: [PATCH] [PATCH] Fix spin lock on systems with poor clock
---
runit-2.1.2/src/svlogd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/runit-2.1.2/src/svlogd.c b/runit-2.1.2/src/svlogd.c
index 90a3321..fab8441 100644
--- a/runit-2.1.2/src/svlogd.c
+++ b/runit-2.1.2/src/svlogd.c
@@ -234,7 +234,7 @@ void rmoldest(struct logdir *ld) {
if (unlink(f->d_name) == -1)
warn2("unable to unlink processor leftover", f->d_name);
}
- else {
+ else if (f->d_name[26] != 'u') {
++n;
if (str_diff(f->d_name, oldest) < 0) byte_copy(oldest, 27, f->d_name);
}

View File

@@ -0,0 +1,27 @@
diff -ruN admin/runit-2.1.2/package/commands admin.new/runit-2.1.2/package/commands
--- admin/runit-2.1.2/package/commands 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/package/commands 2020-04-29 00:52:22.669255084 +0300
@@ -5,5 +5,7 @@
runsvchdir
runsvdir
sv
+svwaitdown
+svwaitup
svlogd
utmpset
diff -ruN admin/runit-2.1.2/src/Makefile admin.new/runit-2.1.2/src/Makefile
--- admin/runit-2.1.2/src/Makefile 2014-08-10 22:22:35.000000000 +0400
+++ admin.new/runit-2.1.2/src/Makefile 2020-04-29 00:50:35.024580450 +0300
@@ -1,9 +1,10 @@
-IT=chpst runit runit-init runsv runsvchdir runsvdir sv svlogd utmpset
+IT=chpst runit runit-init runsv runsvchdir runsvdir sv svlogd svwaitdown svwaitup utmpset
+ME=chpst runit runit-init runsv runsvchdir runsvdir sv svlogd utmpset
default: sysdeps $(IT)
check: $(IT)
- ./check-local $(IT)
+ ./check-local $(ME)
runit: load runit.o unix.a byte.a
./load runit unix.a byte.a -static

View File

@@ -0,0 +1,13 @@
diff -ruNp admin/runit-2.1.2/src/alloc.c admin.new/runit-2.1.2/src/alloc.c
--- admin/runit-2.1.2/src/alloc.c 2014-08-10 22:22:34.000000000 +0400
+++ admin.new/runit-2.1.2/src/alloc.c 2020-11-04 19:12:09.110651948 +0300
@@ -18,7 +18,7 @@ unsigned int n;
char *x;
n = ALIGNMENT + n - (n & (ALIGNMENT - 1)); /* XXX: could overflow */
if (n <= avail) { avail -= n; return space + avail; }
- x = malloc(n);
+ x = calloc(n, sizeof(char));
if (!x) errno = error_nomem;
return x;
}