upg runit openssh

This commit is contained in:
joborun linux 2024-09-20 16:31:57 +03:00
parent d5d83cf495
commit 0b37c8493f
26 changed files with 3140 additions and 55 deletions

View file

@ -6,8 +6,8 @@
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgname=openssh
pkgver=9.8p1
pkgrel=02
pkgver=9.9p1
pkgrel=01
pkgdesc="SSH protocol implementation for remote login, command execution and file transfer w/o systemd"
url='https://www.openssh.com/portable.html'
depends=(glibc)
@ -152,11 +152,11 @@ license=(BSD-2-Clause
validpgpkeys=('7168B983815A5EEF59A4ADFD2A3F414E736060BA') # "Damien Miller <djm@mindrot.org>"
sha256sums=(dd8bd002a379b5d499dfb050dd1fa9af8029e80461f4bb6c523c49973f5a39f3 # openssh-9.8p1.tar.gz
dbb65803565909f2c541db9b45385249cacbf021a0cd4189836bff5c3832d4b9 # openssh-9.8p1.tar.gz.asc
sha256sums=(b343fbcdbff87f15b1986e6e15d6d4fc9a7d36066be6b7fb507087ba8f966c02 # openssh-9.9p1.tar.gz
0a3c462e9cb862bf0bb3a56c7251091f1c88a47724d10cede3ea018f97cf1c94 # openssh-9.9p1.tar.gz.asc
78b806c38bc1e246daaa941bfe7880e6eb6f53f093bea5d5868525ae6d223d30 # 99-archlinux.conf
fadd31c107aee3fc6b501ca046aeb5e6fb1b0256cc5cdcade4e2c95205823a28 # openssh.tmpfiles
64576021515c0a98b0aaf0a0ae02e0f5ebe8ee525b1e647ab68f369f81ecd846) # sshd.pam
## 04c09276e83595b52c4e4c866fd2eb9df0780df60c886e441f9b2180b52e8714 openssh-9.8p1-02-x86_64.pkg.tar.lz
## ca02476da84a071022b1138670d9d517e542a96f6d827482da1cd34f3ffec6fe openssh-9.9p1-01-x86_64.pkg.tar.lz

View file

@ -6,8 +6,8 @@
# Contributor: judd <jvinet@zeroflux.org>
pkgname=openssh
pkgver=9.8p1
pkgrel=2
pkgver=9.9p1
pkgrel=1
pkgdesc="SSH protocol implementation for remote login, command execution and file transfer"
arch=(x86_64)
url='https://www.openssh.com/portable.html'
@ -51,7 +51,7 @@ source=(
ssh-agent.service
sshd.pam
)
sha256sums=('dd8bd002a379b5d499dfb050dd1fa9af8029e80461f4bb6c523c49973f5a39f3'
sha256sums=('b343fbcdbff87f15b1986e6e15d6d4fc9a7d36066be6b7fb507087ba8f966c02'
'SKIP'
'78b806c38bc1e246daaa941bfe7880e6eb6f53f093bea5d5868525ae6d223d30'
'fadd31c107aee3fc6b501ca046aeb5e6fb1b0256cc5cdcade4e2c95205823a28'
@ -59,7 +59,7 @@ sha256sums=('dd8bd002a379b5d499dfb050dd1fa9af8029e80461f4bb6c523c49973f5a39f3'
'201af9f6e00700ebbfd3600c0025c022bff28f9bfd073e1a55756bfdf3bb2d5a'
'fc70b23ec083a5fc45f37049ba7fa12164a800d83c701e852a8315d48a0ff13e'
'633e24cbfcb045ba777d3e06d5f85dfaa06d44f4727d38c7fb2187c57498221d')
b2sums=('3bf983c4ef5358054ed0104cd51d3e0069fbc2b80d8522d0df644d5508ec1d26a67bf061b1b5698d1cdf0d2cbba16b4cdca12a4ce30da24429094576a075e192'
b2sums=('817d267e42b8be74a13e0cfd7999bdb4dab6355c7f62c1a4dd89adad310c5fb7fe3f17109ce1a36cd269a3639c1b8f1d18330c615ab3b419253ec027cfa20997'
'SKIP'
'1ff8cd4ae22efed2b4260f1e518de919c4b290be4e0b5edbc8e2225ffe63788678d1961e6f863b85974c4697428ee827bcbabad371cfc91cc8b36eae9402eb97'
'57e77e55fcbd9d7b9951adbafe11ba62e4b8b7338c2a6fe3f163afe5b84458db042024cefbc55f9393cf17d97d067f1c2d9c61880516501bfa4e5c92371e494a'

View file

@ -0,0 +1,69 @@
From e16a8c3a9d2a1aadc6e18f826161f2cabe9d650f Mon Sep 17 00:00:00 2001
From: "Z. Liu" <zhixu.liu@gmail.com>
Date: Sat, 24 Aug 2024 22:44:05 +0800
Subject: [PATCH 01/20] show full build command and do not redirect to
/dev/null
Show full build command so we can check the build option.
Remove redirect to /dev/null, so we can check & determine whether the
error is desired or is caused by stricter compiler check. Later case
should be fixed in source file.
In case of choose.sh, redirect stdout to stderr because script's stdout will be
redirect to a source file which will be used in later compilation
---
admin/runit-2.1.2/src/Makefile | 4 ++--
admin/runit-2.1.2/src/choose.sh | 6 +++---
admin/runit-2.1.2/src/warn-auto.sh | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/admin/runit-2.1.2/src/Makefile b/admin/runit-2.1.2/src/Makefile
index d9624de..28654b0 100644
--- a/admin/runit-2.1.2/src/Makefile
+++ b/admin/runit-2.1.2/src/Makefile
@@ -99,8 +99,8 @@ reboot_system.h: choose compile reboot_system.h1 reboot_system.h2
reboot_system.h
uw_tmp.h: compile uw_tmp.h1 uw_tmp.h2
- ( ./compile tryuwtmpx.c 2>/dev/null && cat uw_tmp.h2 >uw_tmp.h ) || \
- ( ./compile tryuwtmp.c 2>/dev/null && cat uw_tmp.h1 >uw_tmp.h )
+ ( ./compile tryuwtmpx.c && cat uw_tmp.h2 >uw_tmp.h ) || \
+ ( ./compile tryuwtmp.c && cat uw_tmp.h1 >uw_tmp.h )
rm -f tryuwtmp.o tryuwtmpx.o
socket.lib: compile load trysocketlib.c
diff --git a/admin/runit-2.1.2/src/choose.sh b/admin/runit-2.1.2/src/choose.sh
index feff2da..0b42f2d 100644
--- a/admin/runit-2.1.2/src/choose.sh
+++ b/admin/runit-2.1.2/src/choose.sh
@@ -2,15 +2,15 @@
result="$4"
case "$1" in
- *c*) ./compile $2.c >/dev/null 2>&1 || result="$3" ;;
+ *c*) ./compile $2.c 1>&2 || result="$3" ;;
esac
case "$1" in
- *l*) ./load $2 >/dev/null 2>&1 || result="$3" ;;
+ *l*) ./load $2 1>&2 || result="$3" ;;
esac
case "$1" in
- *r*) ./$2 >/dev/null 2>&1 || result="$3" ;;
+ *r*) ./$2 1>&2 || result="$3" ;;
esac
rm -f $2.o $2
diff --git a/admin/runit-2.1.2/src/warn-auto.sh b/admin/runit-2.1.2/src/warn-auto.sh
index 36d2313..eb35010 100644
--- a/admin/runit-2.1.2/src/warn-auto.sh
+++ b/admin/runit-2.1.2/src/warn-auto.sh
@@ -1,2 +1,2 @@
-#!/bin/sh
+#!/bin/sh -x
# WARNING: This file was auto-generated. Do not edit!
--
2.26.2

View file

@ -0,0 +1,150 @@
From 02d3301359f664c46beebd64c8f3ffb14b5d7518 Mon Sep 17 00:00:00 2001
From: "Z. Liu" <zhixu.liu@gmail.com>
Date: Sat, 24 Aug 2024 23:01:29 +0800
Subject: [PATCH 02/20] fix undesired compilation error(s) of feature test
If don't fix, the feature test will generate undesired .h which will be used
in later compilation, some will cause build failed.
see *.h{1,2} for details, run following cmd to see difference:
diff -uprN <(more *.h1|sed 's:\.h1$:.h:g') <(more *.h2|sed 's:\.h2$:.h:g')
found by using clang 18 with CFLAGS: -Wall
link of debian's patches is: https://salsa.debian.org/debian/runit/-/tree/master/debian/patches
0029-fix-ftbfs-with-gcc14.patch
chkshsgr.c trycpp.c trypoll.c tryshsgr.c tryulong64.c:
error: call to undeclared function '...'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
functions are: _exit, exit, getgroups, printf, setgroups
tryflock.c trysgact.c trysgprm.c trywaitp.c:
error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
---
admin/runit-2.1.2/src/chkshsgr.c | 1 +
admin/runit-2.1.2/src/trycpp.c | 3 +++
admin/runit-2.1.2/src/tryflock.c | 2 +-
admin/runit-2.1.2/src/trypoll.c | 1 +
admin/runit-2.1.2/src/trysgact.c | 2 +-
admin/runit-2.1.2/src/trysgprm.c | 2 +-
admin/runit-2.1.2/src/tryshsgr.c | 3 +++
admin/runit-2.1.2/src/tryulong64.c | 2 ++
admin/runit-2.1.2/src/trywaitp.c | 2 +-
9 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/admin/runit-2.1.2/src/chkshsgr.c b/admin/runit-2.1.2/src/chkshsgr.c
index 38c352d..a33403b 100644
--- a/admin/runit-2.1.2/src/chkshsgr.c
+++ b/admin/runit-2.1.2/src/chkshsgr.c
@@ -1,6 +1,7 @@
/* Public domain. */
#include <unistd.h>
+#include <grp.h>
int main()
{
diff --git a/admin/runit-2.1.2/src/trycpp.c b/admin/runit-2.1.2/src/trycpp.c
index e4503d4..70bc8d6 100644
--- a/admin/runit-2.1.2/src/trycpp.c
+++ b/admin/runit-2.1.2/src/trycpp.c
@@ -1,5 +1,8 @@
/* Public domain. */
+#include <stdio.h>
+#include <stdlib.h>
+
int main()
{
#ifdef NeXT
diff --git a/admin/runit-2.1.2/src/tryflock.c b/admin/runit-2.1.2/src/tryflock.c
index a82ffc2..68599d3 100644
--- a/admin/runit-2.1.2/src/tryflock.c
+++ b/admin/runit-2.1.2/src/tryflock.c
@@ -4,7 +4,7 @@
#include <sys/file.h>
#include <fcntl.h>
-main()
+int main()
{
flock(0,LOCK_EX | LOCK_UN | LOCK_NB);
}
diff --git a/admin/runit-2.1.2/src/trypoll.c b/admin/runit-2.1.2/src/trypoll.c
index 6506617..ae36929 100644
--- a/admin/runit-2.1.2/src/trypoll.c
+++ b/admin/runit-2.1.2/src/trypoll.c
@@ -1,5 +1,6 @@
/* Public domain. */
+#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <poll.h>
diff --git a/admin/runit-2.1.2/src/trysgact.c b/admin/runit-2.1.2/src/trysgact.c
index e264ef2..841b88a 100644
--- a/admin/runit-2.1.2/src/trysgact.c
+++ b/admin/runit-2.1.2/src/trysgact.c
@@ -2,7 +2,7 @@
#include <signal.h>
-main()
+int main()
{
struct sigaction sa;
sa.sa_handler = 0;
diff --git a/admin/runit-2.1.2/src/trysgprm.c b/admin/runit-2.1.2/src/trysgprm.c
index a46c82c..3e78a82 100644
--- a/admin/runit-2.1.2/src/trysgprm.c
+++ b/admin/runit-2.1.2/src/trysgprm.c
@@ -2,7 +2,7 @@
#include <signal.h>
-main()
+int main()
{
sigset_t ss;
diff --git a/admin/runit-2.1.2/src/tryshsgr.c b/admin/runit-2.1.2/src/tryshsgr.c
index c5ed6d6..1bb5f61 100644
--- a/admin/runit-2.1.2/src/tryshsgr.c
+++ b/admin/runit-2.1.2/src/tryshsgr.c
@@ -1,5 +1,8 @@
/* Public domain. */
+#include <unistd.h>
+#include <grp.h>
+
int main()
{
short x[4];
diff --git a/admin/runit-2.1.2/src/tryulong64.c b/admin/runit-2.1.2/src/tryulong64.c
index 003548a..a4b9839 100644
--- a/admin/runit-2.1.2/src/tryulong64.c
+++ b/admin/runit-2.1.2/src/tryulong64.c
@@ -1,5 +1,7 @@
/* Public domain. */
+#include <unistd.h>
+
int main()
{
unsigned long u;
diff --git a/admin/runit-2.1.2/src/trywaitp.c b/admin/runit-2.1.2/src/trywaitp.c
index 319b81f..76b3329 100644
--- a/admin/runit-2.1.2/src/trywaitp.c
+++ b/admin/runit-2.1.2/src/trywaitp.c
@@ -3,7 +3,7 @@
#include <sys/types.h>
#include <sys/wait.h>
-main()
+int main()
{
waitpid(0,0,0);
}
--
2.26.2

View file

@ -0,0 +1,70 @@
From 765dd573e9cc876f7f4b742281a5926b8f845bbf Mon Sep 17 00:00:00 2001
From: "Z. Liu" <zhixu.liu@gmail.com>
Date: Sat, 24 Aug 2024 23:25:03 +0800
Subject: [PATCH 03/20] fix compilation error(s): call to undeclared function
for C99 and later
found by using clang 18 with CFLAGS: -Wall
error: call to undeclared function '...'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
chpst.c: setgroups
pathexec_run.c: execve
prot.c: setgroups, setgid, setuid
seek_set.c: lseek
---
admin/runit-2.1.2/src/chpst.c | 1 +
admin/runit-2.1.2/src/pathexec_run.c | 1 +
admin/runit-2.1.2/src/prot.c | 2 ++
admin/runit-2.1.2/src/seek_set.c | 1 +
4 files changed, 5 insertions(+)
diff --git a/admin/runit-2.1.2/src/chpst.c b/admin/runit-2.1.2/src/chpst.c
index f1b8ed9..a0bd4e6 100644
--- a/admin/runit-2.1.2/src/chpst.c
+++ b/admin/runit-2.1.2/src/chpst.c
@@ -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"
diff --git a/admin/runit-2.1.2/src/pathexec_run.c b/admin/runit-2.1.2/src/pathexec_run.c
index 1770ac7..70ac7a8 100644
--- a/admin/runit-2.1.2/src/pathexec_run.c
+++ b/admin/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"
diff --git a/admin/runit-2.1.2/src/prot.c b/admin/runit-2.1.2/src/prot.c
index 79a88c5..a617a53 100644
--- a/admin/runit-2.1.2/src/prot.c
+++ b/admin/runit-2.1.2/src/prot.c
@@ -1,5 +1,7 @@
/* Public domain. */
+#include <unistd.h>
+#include <grp.h>
#include "hasshsgr.h"
#include "prot.h"
diff --git a/admin/runit-2.1.2/src/seek_set.c b/admin/runit-2.1.2/src/seek_set.c
index 19b8265..a1a36d0 100644
--- a/admin/runit-2.1.2/src/seek_set.c
+++ b/admin/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 */
--
2.26.2

View file

@ -0,0 +1,79 @@
From d91b6f34c1c9eea61ccc9af79e45f8434314b068 Mon Sep 17 00:00:00 2001
From: "Z. Liu" <zhixu.liu@gmail.com>
Date: Wed, 28 Aug 2024 14:45:12 +0800
Subject: [PATCH 04/20] fix compilation errors(s)/warning(s) of x86_cpuid.c
found by using clang 18 with CFLAGS: -Wall
link of debian's patches is: https://salsa.debian.org/debian/runit/-/tree/master/debian/patches
0029-fix-ftbfs-with-gcc14.patch
x86cpuid.c:7:3: error: call to undeclared library function 'exit' with type 'void (int) __attribute__((noreturn))'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
7 | exit(1);
| ^
x86cpuid.c:34:7: error: call to undeclared function 'putchar'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
34 | putchar(c);
| ^
x86cpuid.c:37:3: error: call to undeclared library function 'printf' with type 'int (const char *, ...)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
37 | printf("-%08x-%08x\n",y[0],y[3]);
| ^
x86cpuid.c:37:25: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
37 | printf("-%08x-%08x\n",y[0],y[3]);
| ~~~~ ^~~~
| %08lx
x86cpuid.c:37:30: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
37 | printf("-%08x-%08x\n",y[0],y[3]);
| ~~~~ ^~~~
| %08lx
gcc report:
x86cpuid.c:7:3: warning: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
x86cpuid.c:7:3: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
x86cpuid.c:34:7: warning: implicit declaration of function 'putchar' [-Wimplicit-function-declaration]
x86cpuid.c:37:3: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
x86cpuid.c:37:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
x86cpuid.c:37:15: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=]
x86cpuid.c:37:20: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Wformat=]
---
admin/runit-2.1.2/src/x86cpuid.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/admin/runit-2.1.2/src/x86cpuid.c b/admin/runit-2.1.2/src/x86cpuid.c
index f81c593..5cb6670 100644
--- a/admin/runit-2.1.2/src/x86cpuid.c
+++ b/admin/runit-2.1.2/src/x86cpuid.c
@@ -1,5 +1,7 @@
/* Public domain. */
+#include <stdio.h>
+#include <stdlib.h>
#include <signal.h>
void nope()
@@ -17,10 +19,10 @@ int main()
signal(SIGILL,nope);
- x[0] = 0;
- x[1] = 0;
- x[2] = 0;
- x[3] = 0;
+ x[0] = y[0] = 0;
+ x[1] = y[1] = 0;
+ x[2] = y[2] = 0;
+ x[3] = 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;
@@ -34,7 +36,7 @@ int main()
putchar(c);
}
- printf("-%08x-%08x\n",y[0],y[3]);
+ printf("-%08lx-%08lx\n",y[0],y[3]);
return 0;
}
--
2.26.2

View file

@ -0,0 +1,126 @@
From be37c30ca69c6e9a180db807d4290ff1e255a761 Mon Sep 17 00:00:00 2001
From: "Z. Liu" <zhixu.liu@gmail.com>
Date: Sun, 25 Aug 2024 00:16:19 +0800
Subject: [PATCH 05/20] fix compilation warning(s):
-Wincompatible-pointer-types
found by using clang 18 with CFLAGS: -Wall
since gcc 14, certain warnings (including this one) are now errors, see
https://gcc.gnu.org/gcc-14/porting_to.html
link of debian's patches is: https://salsa.debian.org/debian/runit/-/tree/master/debian/patches
0003-utmpset.c-mixes-int32_t-and-time_t.diff
0014-fix-implicit-declarations-incompatible-types-argv-ty.patch
0029-fix-ftbfs-with-gcc14.patch
fix for utmpset.c is borrowed from debian
fix for {chkshsgr,tryshsgr}.c, can't change type of x[4] from short to
gid_t, the reason is (as Gerrit Pape commented):
"tryshsgr" is specifically there to check whether the size of gid_t
is short, it doesn't matter if it fails at compile time or run time.
But with this change, it always succeeds, and so always size short is
assumed, even though most systems should have unsigned int I guess.
[chkshsgr|tryshsgr].c:11:19: warning: incompatible pointer types passing 'short[4]' to parameter of type '__gid_t *' (aka 'unsigned int *') [-Wincompatible-pointer-types]
11 | if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1);
| ^
[chkshsgr|tryshsgr].c:11:44: warning: incompatible pointer types passing 'short[4]' to parameter of type 'const __gid_t *' (aka 'const unsigned int *') [-Wincompatible-pointer-types]
11 | if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1);
| ^
tryshsgr.c: warning: incompatible pointer types passing 'short[4]' to parameter of type '__gid_t *' (aka 'unsigned int *') [-Wincompatible-pointer-types]
13 | if (getgroups(1,x) == -1) _exit(1);
| ^
16 | if (getgroups(1,x) == -1) _exit(1);
| ^
utmpset.c: warning: incompatible pointer types passing 'int32_t *' (aka 'int *') to parameter of type 'time_t *' (aka 'long *') [-Wincompatible-pointer-types]
38 | if (time(&ut.ut_time) == -1) break;
| ^~~~~~~~~~~
68 | if (time(&ut.ut_time) == -1) {
| ^~~~~~~~~~~
---
admin/runit-2.1.2/src/chkshsgr.c | 2 +-
admin/runit-2.1.2/src/tryshsgr.c | 6 +++---
admin/runit-2.1.2/src/utmpset.c | 8 ++++++--
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/admin/runit-2.1.2/src/chkshsgr.c b/admin/runit-2.1.2/src/chkshsgr.c
index a33403b..470f565 100644
--- a/admin/runit-2.1.2/src/chkshsgr.c
+++ b/admin/runit-2.1.2/src/chkshsgr.c
@@ -8,6 +8,6 @@ int main()
short x[4];
x[0] = x[1] = 0;
- if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1);
+ if (getgroups(1,(gid_t *)x) == 0) if (setgroups(1,(gid_t *)x) == -1) _exit(1);
_exit(0);
}
diff --git a/admin/runit-2.1.2/src/tryshsgr.c b/admin/runit-2.1.2/src/tryshsgr.c
index 1bb5f61..4089751 100644
--- a/admin/runit-2.1.2/src/tryshsgr.c
+++ b/admin/runit-2.1.2/src/tryshsgr.c
@@ -8,12 +8,12 @@ int main()
short x[4];
x[0] = x[1] = 1;
- if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1);
+ if (getgroups(1,(gid_t *)x) == 0) if (setgroups(1,(gid_t *)x) == -1) _exit(1);
- if (getgroups(1,x) == -1) _exit(1);
+ if (getgroups(1,(gid_t *)x) == -1) _exit(1);
if (x[1] != 1) _exit(1);
x[1] = 2;
- if (getgroups(1,x) == -1) _exit(1);
+ if (getgroups(1,(gid_t *)x) == -1) _exit(1);
if (x[1] != 2) _exit(1);
_exit(0);
}
diff --git a/admin/runit-2.1.2/src/utmpset.c b/admin/runit-2.1.2/src/utmpset.c
index eea41a5..2e8a525 100644
--- a/admin/runit-2.1.2/src/utmpset.c
+++ b/admin/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.26.2

View file

@ -0,0 +1,326 @@
From 09649f18af595780358e7fd723b39d075477d0e5 Mon Sep 17 00:00:00 2001
From: "Z. Liu" <zhixu.liu@gmail.com>
Date: Sun, 25 Aug 2024 01:32:48 +0800
Subject: [PATCH 06/20] fix compilation warning(s):
-Wincompatible-pointer-types-discards-qualifiers
found by using clang 18 with CFLAGS: -Wall
since gcc 14, certain warnings (including this one, gcc report as
-Wincompatible-pointer-types) are now errors, see
https://gcc.gnu.org/gcc-14/porting_to.html
link of debian's patches is: https://salsa.debian.org/debian/runit/-/tree/master/debian/patches
0014-fix-implicit-declarations-incompatible-types-argv-ty.patch
pathexec_run.c: warning: passing 'const char *const *' to parameter of type 'char *const *' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
19 | execve(file,argv,envp);
| ^~~~ ^~~~
36 | execve(tmp.s,argv,envp);
| ^~~~ ^~~~
pathexec_env.c:67:21: warning: passing 'const char *const *' to parameter of type 'char *const *' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
67 | pathexec_run(file,argv,e);
| ^~~~
pathexec_env.c:67:26: warning: passing 'const char **' to parameter of type 'char *const *' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
67 | pathexec_run(file,argv,e);
| ^
runsvdir.c:74:25: warning: passing 'const char *[3]' to parameter of type 'char *const *' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
74 | pathexec_run(*prog, prog, (const char* const*)environ);
| ^~~~
runsvdir.c:74:31: warning: passing 'const char *const *' to parameter of type 'char *const *' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
74 | pathexec_run(*prog, prog, (const char* const*)environ);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
---
admin/runit-2.1.2/src/chpst.c | 30 ++++++++++++++--------------
admin/runit-2.1.2/src/pathexec.h | 6 +++---
admin/runit-2.1.2/src/pathexec_env.c | 8 ++++----
admin/runit-2.1.2/src/pathexec_run.c | 2 +-
admin/runit-2.1.2/src/runsvdir.c | 4 ++--
admin/runit-2.1.2/src/sgetopt.c | 2 +-
admin/runit-2.1.2/src/sgetopt.h | 2 +-
admin/runit-2.1.2/src/subgetopt.c | 2 +-
admin/runit-2.1.2/src/subgetopt.h | 2 +-
admin/runit-2.1.2/src/sv.c | 2 +-
admin/runit-2.1.2/src/svlogd.c | 4 ++--
admin/runit-2.1.2/src/utmpset.c | 2 +-
12 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/admin/runit-2.1.2/src/chpst.c b/admin/runit-2.1.2/src/chpst.c
index a0bd4e6..2b9eb01 100644
--- a/admin/runit-2.1.2/src/chpst.c
+++ b/admin/runit-2.1.2/src/chpst.c
@@ -41,7 +41,7 @@ void usage() { strerr_die4x(100, "usage: ", progname, USAGE_MAIN, "\n"); }
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;
@@ -259,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 *);
-
-int main(int argc, const char **argv) {
+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, char **argv) {
int opt;
int i;
unsigned long ul;
@@ -367,7 +367,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 +380,7 @@ void setuidgid(int argc, const char *const *argv) {
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 +393,7 @@ void envuidgid(int argc, const char *const *argv) {
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 +406,7 @@ void envdir(int argc, const char *const *argv) {
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 +416,7 @@ void pgrphack(int argc, const char *const *argv) {
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 +450,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 --git a/admin/runit-2.1.2/src/pathexec.h b/admin/runit-2.1.2/src/pathexec.h
index d46ab17..46af3e0 100644
--- a/admin/runit-2.1.2/src/pathexec.h
+++ b/admin/runit-2.1.2/src/pathexec.h
@@ -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 --git a/admin/runit-2.1.2/src/pathexec_env.c b/admin/runit-2.1.2/src/pathexec_env.c
index 1305469..f873094 100644
--- a/admin/runit-2.1.2/src/pathexec_env.c
+++ b/admin/runit-2.1.2/src/pathexec_env.c
@@ -22,9 +22,9 @@ int pathexec_env(const char *s,const char *t)
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, const char *const *argv)
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, const char *const *argv)
alloc_free(e);
}
-void pathexec(const char *const *argv)
+void pathexec(char *const *argv)
{
return pathexec_env_run(*argv, argv);
}
diff --git a/admin/runit-2.1.2/src/pathexec_run.c b/admin/runit-2.1.2/src/pathexec_run.c
index 70ac7a8..8d159a8 100644
--- a/admin/runit-2.1.2/src/pathexec_run.c
+++ b/admin/runit-2.1.2/src/pathexec_run.c
@@ -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 --git a/admin/runit-2.1.2/src/runsvdir.c b/admin/runit-2.1.2/src/runsvdir.c
index 07c1d8e..88983c7 100644
--- a/admin/runit-2.1.2/src/runsvdir.c
+++ b/admin/runit-2.1.2/src/runsvdir.c
@@ -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 --git a/admin/runit-2.1.2/src/sgetopt.c b/admin/runit-2.1.2/src/sgetopt.c
index 8bb608f..778bca2 100644
--- a/admin/runit-2.1.2/src/sgetopt.c
+++ b/admin/runit-2.1.2/src/sgetopt.c
@@ -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 --git a/admin/runit-2.1.2/src/sgetopt.h b/admin/runit-2.1.2/src/sgetopt.h
index bf8bce6..eb4cbf8 100644
--- a/admin/runit-2.1.2/src/sgetopt.h
+++ b/admin/runit-2.1.2/src/sgetopt.h
@@ -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 --git a/admin/runit-2.1.2/src/subgetopt.c b/admin/runit-2.1.2/src/subgetopt.c
index 85ace96..a23e0d7 100644
--- a/admin/runit-2.1.2/src/subgetopt.c
+++ b/admin/runit-2.1.2/src/subgetopt.c
@@ -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 --git a/admin/runit-2.1.2/src/subgetopt.h b/admin/runit-2.1.2/src/subgetopt.h
index 41ad26a..5163148 100644
--- a/admin/runit-2.1.2/src/subgetopt.h
+++ b/admin/runit-2.1.2/src/subgetopt.h
@@ -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 --git a/admin/runit-2.1.2/src/sv.c b/admin/runit-2.1.2/src/sv.c
index 0125795..e9c7f21 100644
--- a/admin/runit-2.1.2/src/sv.c
+++ b/admin/runit-2.1.2/src/sv.c
@@ -281,7 +281,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 --git a/admin/runit-2.1.2/src/svlogd.c b/admin/runit-2.1.2/src/svlogd.c
index 90a3321..082e20c 100644
--- a/admin/runit-2.1.2/src/svlogd.c
+++ b/admin/runit-2.1.2/src/svlogd.c
@@ -52,7 +52,7 @@ unsigned long linelen;
const char *replace ="";
char repl =0;
-const char **fndir;
+char **fndir;
int fdwdir;
struct stat st;
stralloc sa;
@@ -661,7 +661,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 --git a/admin/runit-2.1.2/src/utmpset.c b/admin/runit-2.1.2/src/utmpset.c
index 2e8a525..c50be64 100644
--- a/admin/runit-2.1.2/src/utmpset.c
+++ b/admin/runit-2.1.2/src/utmpset.c
@@ -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, const char * const *envp) {
int opt;
int wtmp =0;
--
2.26.2

View file

@ -0,0 +1,111 @@
From 7061e17017e64415efa2cdd87bbca906edfe9d1a Mon Sep 17 00:00:00 2001
From: "Z. Liu" <zhixu.liu@gmail.com>
Date: Wed, 28 Aug 2024 15:35:55 +0800
Subject: [PATCH 07/20] support /etc/runit/nosync file to make sync on
shutdown/reboot optional
this patch is applied by Gerrit Pape, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=695281
copied from debian's patch:
0002-support-etc-runit-nosync-file-to-make-sync-on-shutdow.diff
links of debian's patches is: https://salsa.debian.org/debian/runit/-/tree/master/debian/patches
---
admin/runit-2.1.2/doc/runit.8.html | 2 ++
admin/runit-2.1.2/man/runit.8 | 5 +++++
admin/runit-2.1.2/src/runit.c | 15 ++++++++++-----
admin/runit-2.1.2/src/runit.h | 1 +
4 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/admin/runit-2.1.2/doc/runit.8.html b/admin/runit-2.1.2/doc/runit.8.html
index 6c46b39..3cc8287 100644
--- a/admin/runit-2.1.2/doc/runit.8.html
+++ b/admin/runit-2.1.2/doc/runit.8.html
@@ -34,6 +34,8 @@ stage 2 if it is running, and runs <i>/etc/runit/3</i>. The systems tasks to shu
and possibly halt or reboot the system are done here. If stage 3 returns,
<b>runit</b> checks if the file <i>/etc/runit/reboot</i> exists and has the execute by
owner permission set. If so, the system is rebooted, it&rsquo;s halted otherwise.
+If <i>/etc/runit/nosync</i> exists, <b>runit</b> doesn&rsquo;t invoke
+sync(). This is useful in vservers.
<h2><a name='sect6'>Ctrl-alt-del</a></h2>
If <b>runit</b> receives the ctrl-alt-del keyboard request and the file
diff --git a/admin/runit-2.1.2/man/runit.8 b/admin/runit-2.1.2/man/runit.8
index a53cf6e..faf789b 100644
--- a/admin/runit-2.1.2/man/runit.8
+++ b/admin/runit-2.1.2/man/runit.8
@@ -48,6 +48,11 @@ checks if the file
.I /etc/runit/reboot
exists and has the execute by owner permission set.
If so, the system is rebooted, it's halted otherwise.
+If
+.I /etc/runit/nosync
+exists,
+.B runit
+doesn't invoke sync(). This is useful in vservers.
.SH CTRL-ALT-DEL
If
.B runit
diff --git a/admin/runit-2.1.2/src/runit.c b/admin/runit-2.1.2/src/runit.c
index 48620b3..2bb4794 100644
--- a/admin/runit-2.1.2/src/runit.c
+++ b/admin/runit-2.1.2/src/runit.c
@@ -41,6 +41,11 @@ void sig_int_handler (void) {
}
void sig_child_handler (void) { write(selfpipe[1], "", 1); }
+void sync_if_needed() {
+ struct stat s;
+ if (stat(NOSYNC, &s) == -1) sync();
+}
+
int main (int argc, const char * const *argv, char * const *envp) {
const char * prog[2];
int pid, pid2;
@@ -305,28 +310,28 @@ int main (int argc, const char * const *argv, char * const *envp) {
case -1:
if ((stat(REBOOT, &s) != -1) && (s.st_mode & S_IXUSR)) {
strerr_warn2(INFO, "system reboot.", 0);
- sync();
+ sync_if_needed();
reboot_system(RB_AUTOBOOT);
}
else {
#ifdef RB_POWER_OFF
strerr_warn2(INFO, "power off...", 0);
- sync();
+ sync_if_needed();
reboot_system(RB_POWER_OFF);
sleep(2);
#endif
#ifdef RB_HALT_SYSTEM
strerr_warn2(INFO, "system halt.", 0);
- sync();
+ sync_if_needed();
reboot_system(RB_HALT_SYSTEM);
#else
#ifdef RB_HALT
strerr_warn2(INFO, "system halt.", 0);
- sync();
+ sync_if_needed();
reboot_system(RB_HALT);
#else
strerr_warn2(INFO, "system reboot.", 0);
- sync();
+ sync_if_needed();
reboot_system(RB_AUTOBOOT);
#endif
#endif
diff --git a/admin/runit-2.1.2/src/runit.h b/admin/runit-2.1.2/src/runit.h
index ba98386..3d52001 100644
--- a/admin/runit-2.1.2/src/runit.h
+++ b/admin/runit-2.1.2/src/runit.h
@@ -1,4 +1,5 @@
#define RUNIT "/sbin/runit"
#define STOPIT "/etc/runit/stopit"
#define REBOOT "/etc/runit/reboot"
+#define NOSYNC "/etc/runit/nosync"
#define CTRLALTDEL "/etc/runit/ctrlaltdel"
--
2.26.2

View file

@ -0,0 +1,269 @@
From df08120f2fae7d1f9e2f6c6663fe03ad429baff6 Mon Sep 17 00:00:00 2001
From: "Z. Liu" <zhixu.liu@gmail.com>
Date: Wed, 28 Aug 2024 15:09:50 +0800
Subject: [PATCH 08/20] add/update doc & man page of chpst and runsv
1. fix error in runsv for log/finish:
Log ./finish script is not actually invoked. It is not clear, whether this
limitation is worth lifting.
2. add options -t and -V to chpst man page; ignore -r since it's obsolete.
3. clarify in runsv.8 manpage how signal override works with control/dx
copied from debian's patch:
0009-fix-error-in-manpage.patch
0027-Clarify-runsv-8-control-dx.patch
0027-Add-missing-options-to-chpst-manpage.patch
links of debian's patches is: https://salsa.debian.org/debian/runit/-/tree/master/debian/patches
---
admin/runit-2.1.2/doc/chpst.8.html | 14 +++++++----
admin/runit-2.1.2/doc/runsv.8.html | 20 +++++++++++++---
admin/runit-2.1.2/man/chpst.8 | 18 ++++++++++++---
admin/runit-2.1.2/man/runsv.8 | 37 ++++++++++++++++++++++++++----
admin/runit-2.1.2/src/chpst.c | 2 +-
admin/runit-2.1.2/src/chpst.dist | 4 ++--
6 files changed, 77 insertions(+), 18 deletions(-)
diff --git a/admin/runit-2.1.2/doc/chpst.8.html b/admin/runit-2.1.2/doc/chpst.8.html
index 97d90f2..c481ce2 100644
--- a/admin/runit-2.1.2/doc/chpst.8.html
+++ b/admin/runit-2.1.2/doc/chpst.8.html
@@ -11,9 +11,9 @@
<h2><a name='sect0'>Name</a></h2>
chpst - runs a program with a changed process state
<h2><a name='sect1'>Synopsis</a></h2>
-<b>chpst</b> [-vP012]
+<b>chpst</b> [-vVP012]
[-u <i>user</i>] [-U <i>user</i>] [-b <i>argv0</i>] [-e <i>dir</i>] [-/ <i>root</i>] [-n <i>inc</i>] [-l|-L <i>lock</i>] [-m <i>bytes</i>] [-d <i>bytes</i>]
-[-o <i>n</i>] [-p <i>n</i>] [-f <i>bytes</i>] [-c <i>bytes</i>] <i>prog</i>
+[-o <i>n</i>] [-p <i>n</i>] [-f <i>bytes</i>] [-c <i>bytes</i>] [-t <i>seconds</i>] <i>prog</i>
<h2><a name='sect2'>Description</a></h2>
<i>prog</i> consists of one or
more arguments. <p>
@@ -30,7 +30,7 @@ and a <i>group</i>, set the gid to <i>group</i>&rsquo;s gid, as found in <i>/etc
of <i>user</i>&rsquo;s gid. If <i>group</i> consists of a colon-separated list of group names,
<b>chpst</b> sets the group ids of all listed groups. If <i>user</i> is prefixed with
a colon, the <i>user</i> and all <i>group</i> arguments are interpreted as uid and gids
-respectivly, and not looked up in the password or group file. All initial
+respectively, and not looked up in the password or group file. All initial
supplementary groups are removed. </dd>
<dt><b>-U <i>[:]user[:group]</b> </i></dt>
@@ -38,7 +38,7 @@ supplementary groups are removed. </dd>
variables $UID and $GID to the <i>user</i>&rsquo;s uid and gid, as found in <i>/etc/passwd</i>.
If <i>user</i> is followed by a colon and a <i>group</i>, set $GID to the <i>group</i>&rsquo;s gid,
as found in <i>/etc/group</i>, instead of <i>user</i>&rsquo;s gid. If <i>user</i> is prefixed with a
-colon, the <i>user</i> and <i>group</i> arguments are interpreted as uid and gid respectivly,
+colon, the <i>user</i> and <i>group</i> arguments are interpreted as uid and gid respectively,
and not looked up in the password or group file. </dd>
<dt><b>-b <i>argv0</b> </i></dt>
@@ -98,10 +98,16 @@ the output file size to <i>bytes</i> bytes. </dd>
<dd>limit core size. Limit the core
file size to <i>bytes</i> bytes. </dd>
+<dt><b>-t <i>seconds</b> </i></dt>
+<dd>limit CPU time. Limit CPU time to <i>seconds</i> seconds, delivering a SIGXCPU thereafter.</dd>
+
<dt><b>-v</b> </dt>
<dd>verbose. Print verbose messages to standard error.
This includes warnings about limits unsupported by the system. </dd>
+<dt><b>-V</b> </dt>
+<dd>version string. Print a version string to standard error. </dd>
+
<dt><b>-P</b> </dt>
<dd>pgrphack.
Run <i>prog</i> in a new process group. </dd>
diff --git a/admin/runit-2.1.2/doc/runsv.8.html b/admin/runit-2.1.2/doc/runsv.8.html
index d27deeb..04f299e 100644
--- a/admin/runit-2.1.2/doc/runsv.8.html
+++ b/admin/runit-2.1.2/doc/runsv.8.html
@@ -115,15 +115,29 @@ to send a TERM signal to the socklog-unix service, either do # sv term
<i><b>printf</b>(1)</i> usually blocks if no <b>runsv</b> process is running in the service
directory.
<h2><a name='sect4'>Customize Control</a></h2>
-For each control character <i>c</i> sent to the control
+For each control character <i>c</i> except "d" and "x" sent to the control
pipe, <b>runsv</b> first checks if <i>service</i>/control/<i>c</i> exists and is executable.
If so, it starts <i>service</i>/control/<i>c</i> and waits for it to terminate, before
interpreting the command. If the program exits with return code 0, <b>runsv</b>
refrains from sending the service the corresponding signal. The command
<i>o</i> is always considered as command <i>u</i>. On command <i>d</i> first <i>service</i>/control/<i>t</i>
is checked, and then <i>service</i>/control/<i>d</i>. On command <i>x</i> first <i>service</i>/control/<i>t</i>
-is checked, and then <i>service</i>/control/<i>x</i>. The control of the optional log
-service cannot be customized.
+is checked, and then <i>service</i>/control/<i>x</i>. Specifically:<br>
+<p>
+<dt><b>1.</b> </dt>
+<dd><b>runsv</b> checks whether <i>service</i>/control/<i>t</i> exists and is executable and runs it if yes.</dd>
+
+<dt><b>2.</b> </dt>
+<dd>If <i>service</i>/control/<i>t</i> exits nonzero, or is not executable or doesn't exist, <b>runsv</b> sends
+ the service a TERM signal.</dd>
+
+<dt><b>3.</b> </dt>
+<dd><b>runsv</b> sends the service a CONT signal, disregarding <i>service</i>/control/<i>c</i> even if it exists and is executable.</dd>
+
+<dt><b>4.</b> </dt>
+<dd><b>runsv</b> checks whether <i>service</i>/control/<i>d</i> (or control/<i>x</i>) exists and is executable and runs it if yes. Its exit status is ignored.</dd>
+<p>
+The control of the optional log service cannot be customized.
<h2><a name='sect5'>Signals</a></h2>
If <b>runsv</b> receives a TERM signal, it
acts as if the character x was written to the control pipe.
diff --git a/admin/runit-2.1.2/man/chpst.8 b/admin/runit-2.1.2/man/chpst.8
index 43c0b8d..26c1a1d 100644
--- a/admin/runit-2.1.2/man/chpst.8
+++ b/admin/runit-2.1.2/man/chpst.8
@@ -3,7 +3,7 @@
chpst \- runs a program with a changed process state
.SH SYNOPSIS
.B chpst
-[\-vP012]
+[\-vVP012]
[\-u
.IR user ]
[\-U
@@ -30,6 +30,8 @@ chpst \- runs a program with a changed process state
.IR bytes ]
[-c
.IR bytes ]
+[-t
+.IR seconds ]
.I prog
.SH DESCRIPTION
.I prog
@@ -68,7 +70,7 @@ is prefixed with a colon, the
.I user
and all
.I group
-arguments are interpreted as uid and gids respectivly, and not looked up in
+arguments are interpreted as uid and gids respectively, and not looked up in
the password or group file.
All initial supplementary groups are removed.
.TP
@@ -95,7 +97,7 @@ is prefixed with a colon, the
.I user
and
.I group
-arguments are interpreted as uid and gid respectivly, and not looked up in
+arguments are interpreted as uid and gid respectively, and not looked up in
the password or group file.
.TP
.B \-b \fIargv0
@@ -208,11 +210,21 @@ Limit the core file size to
.I bytes
bytes.
.TP
+.B \-t \fIseconds
+limit CPU time.
+Limit CPU time to
+.I seconds
+seconds, delivering a SIGXCPU thereafter.
+.TP
.B \-v
verbose.
Print verbose messages to standard error.
This includes warnings about limits unsupported by the system.
.TP
+.B \-V
+version string.
+Print a version string to standard error.
+.TP
.B \-P
pgrphack.
Run
diff --git a/admin/runit-2.1.2/man/runsv.8 b/admin/runit-2.1.2/man/runsv.8
index 7c5abfc..43ab396 100644
--- a/admin/runit-2.1.2/man/runsv.8
+++ b/admin/runit-2.1.2/man/runsv.8
@@ -54,10 +54,8 @@ and
.IR service /finish's
standard output to the pipe, switches to the directory
.IR service /log
-and starts ./run (and ./finish) exactly as described above for the
-.I service
-directory.
-The standard input of the log service is redirected to read from the pipe.
+and starts ./run script. The standard input of the log service
+is redirected to read from the pipe.
.P
.B runsv
maintains status information in a binary format (compatible to the
@@ -168,7 +166,7 @@ process is running in the service directory.
.SH CUSTOMIZE CONTROL
For each control character
.I c
-sent to the control pipe,
+except "d" and "x" sent to the control pipe,
.B runsv
first checks if
.I service\fR/control/\fIc
@@ -195,6 +193,35 @@ first
.I service\fR/control/t
is checked, and then
.I service\fR/control/x.
+Specifically:
+.P
+If the service is running or paused, control characters "d" and "x" are handled as follows:
+.TP
+.B 1.
+.B runsv
+checks whether
+.I service\fR/control/t
+exists and is executable and runs it if yes.
+.TP
+.B 2.
+If
+.I service\fR/control/t
+exits nonzero, or is not executable or doesn't exist,
+.B runsv
+sends the service a TERM signal.
+.TP
+.B 3.
+.B runsv
+sends the service a CONT signal, disregarding
+.I service\fR/control/c
+even if it exists and is executable.
+.TP
+.B 4.
+.B runsv
+checks whether
+.I service\fR/control/d (or control/x)
+exists and is executable and runs it if yes. Its exit status is ignored.
+.P
The control of the optional log service cannot be customized.
.SH SIGNALS
If
diff --git a/admin/runit-2.1.2/src/chpst.c b/admin/runit-2.1.2/src/chpst.c
index 2b9eb01..cf7caee 100644
--- a/admin/runit-2.1.2/src/chpst.c
+++ b/admin/runit-2.1.2/src/chpst.c
@@ -21,7 +21,7 @@
#include "openreadclose.h"
#include "direntry.h"
-#define USAGE_MAIN " [-vP012] [-u user[:group]] [-U user[:group]] [-b argv0] [-e dir] [-/ root] [-n nice] [-l|-L lock] [-m n] [-d n] [-o n] [-p n] [-f n] [-c n] prog"
+#define USAGE_MAIN " [-vVP012] [-u user[:group]] [-U user[:group]] [-b argv0] [-e dir] [-/ root] [-n nice] [-l|-L lock] [-m n] [-d n] [-o n] [-p n] [-f n] [-c n] [-t n] prog"
#define FATAL "chpst: fatal: "
#define WARNING "chpst: warning: "
diff --git a/admin/runit-2.1.2/src/chpst.dist b/admin/runit-2.1.2/src/chpst.dist
index 6779bfd..606264c 100644
--- a/admin/runit-2.1.2/src/chpst.dist
+++ b/admin/runit-2.1.2/src/chpst.dist
@@ -1,8 +1,8 @@
-usage: chpst [-vP012] [-u user[:group]] [-U user[:group]] [-b argv0] [-e dir] [-/ root] [-n nice] [-l|-L lock] [-m n] [-d n] [-o n] [-p n] [-f n] [-c n] prog
+usage: chpst [-vVP012] [-u user[:group]] [-U user[:group]] [-b argv0] [-e dir] [-/ root] [-n nice] [-l|-L lock] [-m n] [-d n] [-o n] [-p n] [-f n] [-c n] [-t n] prog
100
$Id: f279d44141c981dd7535a12260efcf1ef7beed26 $
-usage: chpst [-vP012] [-u user[:group]] [-U user[:group]] [-b argv0] [-e dir] [-/ root] [-n nice] [-l|-L lock] [-m n] [-d n] [-o n] [-p n] [-f n] [-c n] prog
+usage: chpst [-vVP012] [-u user[:group]] [-U user[:group]] [-b argv0] [-e dir] [-/ root] [-n nice] [-l|-L lock] [-m n] [-d n] [-o n] [-p n] [-f n] [-c n] [-t n] prog
100
test=1
--
2.26.2

View file

@ -0,0 +1,37 @@
From 42a3caa8daf7e62a5738a7c7a6ba6df24bd8dd43 Mon Sep 17 00:00:00 2001
From: "Z. Liu" <zhixu.liu@gmail.com>
Date: Sun, 25 Aug 2024 00:47:38 +0800
Subject: [PATCH 09/20] fix compilation warning(s): -Wunsequenced
found by using clang 18 with CFLAGS: -Wall
link of debian's patches is: https://salsa.debian.org/debian/runit/-/tree/master/debian/patches
0016-fix-warning-for-undefined-operation-on-sequence-poin.patch
chpst.c:312:33: warning: unsequenced modification and access to 'subgetoptarg' [-Wunsequenced]
312 | if (optarg[scan_ulong(++optarg, &ul)]) usage(); nicelvl =ul;
| ~~~~~~ ^
gcc report:
chpst.c:312:33: warning: operation on 'subgetoptarg' may be undefined [-Wsequence-point]
---
admin/runit-2.1.2/src/chpst.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/admin/runit-2.1.2/src/chpst.c b/admin/runit-2.1.2/src/chpst.c
index cf7caee..55b5a37 100644
--- a/admin/runit-2.1.2/src/chpst.c
+++ b/admin/runit-2.1.2/src/chpst.c
@@ -309,7 +309,8 @@ int main(int argc, 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;
--
2.26.2

View file

@ -0,0 +1,348 @@
From 27e6eabd47991c89cbe83e0ad83436dc264d886c Mon Sep 17 00:00:00 2001
From: "Z. Liu" <zhixu.liu@gmail.com>
Date: Wed, 28 Aug 2024 00:14:26 +0800
Subject: [PATCH 10/20] fix compilation warning(s): -Wmisleading-indentation
found by using gcc 13 with CFLAGS: -Wall
link of debian's patches is: https://salsa.debian.org/debian/runit/-/tree/master/debian/patches
0015-fix-34-cases-of-Wmisleading-indentation-warnings.patch
chpst.c: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
313 | if (optarg[scan_ulong(optarg, &ul)]) usage(); nicelvl =ul;
| ^~
318 | if (optarg[scan_ulong(optarg, &ul)]) usage(); nicelvl =ul;
| ^~
byte_chr.c: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
13 | if (!n) break; if (*t == ch) break; ++t; --n;
| ^~
14 | if (!n) break; if (*t == ch) break; ++t; --n;
| ^~
15 | if (!n) break; if (*t == ch) break; ++t; --n;
| ^~
16 | if (!n) break; if (*t == ch) break; ++t; --n;
| ^~
byte_copy.c: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
8 | if (!n) return; *to++ = *from++; --n;
| ^~
9 | if (!n) return; *to++ = *from++; --n;
| ^~
10 | if (!n) return; *to++ = *from++; --n;
| ^~
11 | if (!n) return; *to++ = *from++; --n;
| ^~
byte_cr.c: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
10 | if (!n) return; *--to = *--from; --n;
| ^~
11 | if (!n) return; *--to = *--from; --n;
| ^~
12 | if (!n) return; *--to = *--from; --n;
| ^~
13 | if (!n) return; *--to = *--from; --n;
| ^~
byte_diff.c: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
8 | if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
| ^~
9 | if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
| ^~
10 | if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
| ^~
11 | if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
| ^~
byte_rchr.c: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
15 | if (!n) break; if (*t == ch) u = t; ++t; --n;
| ^~
16 | if (!n) break; if (*t == ch) u = t; ++t; --n;
| ^~
17 | if (!n) break; if (*t == ch) u = t; ++t; --n;
| ^~
18 | if (!n) break; if (*t == ch) u = t; ++t; --n;
| ^~
str_chr.c: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
13 | if (!*t) break; if (*t == ch) break; ++t;
| ^~
14 | if (!*t) break; if (*t == ch) break; ++t;
| ^~
15 | if (!*t) break; if (*t == ch) break; ++t;
| ^~
16 | if (!*t) break; if (*t == ch) break; ++t;
| ^~
str_len.c: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
11 | if (!*t) return t - s; ++t;
| ^~
12 | if (!*t) return t - s; ++t;
| ^~
13 | if (!*t) return t - s; ++t;
| ^~
14 | if (!*t) return t - s; ++t;
| ^~
sv.c: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
293 | if (!(action =*argv++)) usage(); --argc;
| ^~
394 | if (*s != '.') return 0; ++s; ++len;
| ^~
396 | if (*s != '.') return 0; ++s; ++len;
| ^~
398 | if (*s != '.') return 0; ++s; ++len;
| ^~
---
admin/runit-2.1.2/src/byte_chr.c | 16 ++++++++++++----
admin/runit-2.1.2/src/byte_copy.c | 12 ++++++++----
admin/runit-2.1.2/src/byte_cr.c | 12 ++++++++----
admin/runit-2.1.2/src/byte_diff.c | 16 ++++++++++++----
admin/runit-2.1.2/src/byte_rchr.c | 16 ++++++++++++----
admin/runit-2.1.2/src/chpst.c | 6 ++++--
admin/runit-2.1.2/src/str_chr.c | 16 ++++++++++++----
admin/runit-2.1.2/src/str_len.c | 12 ++++++++----
admin/runit-2.1.2/src/sv.c | 3 ++-
admin/runit-2.1.2/src/svlogd.c | 25 ++++++++++++++++++-------
10 files changed, 96 insertions(+), 38 deletions(-)
diff --git a/admin/runit-2.1.2/src/byte_chr.c b/admin/runit-2.1.2/src/byte_chr.c
index fd56056..020b230 100644
--- a/admin/runit-2.1.2/src/byte_chr.c
+++ b/admin/runit-2.1.2/src/byte_chr.c
@@ -13,10 +13,18 @@ int c;
ch = c;
t = s;
for (;;) {
- if (!n) break; if (*t == ch) break; ++t; --n;
- if (!n) break; if (*t == ch) break; ++t; --n;
- if (!n) break; if (*t == ch) break; ++t; --n;
- if (!n) break; if (*t == ch) break; ++t; --n;
+ if (!n) break;
+ if (*t == ch) break;
+ ++t; --n;
+ if (!n) break;
+ if (*t == ch) break;
+ ++t; --n;
+ if (!n) break;
+ if (*t == ch) break;
+ ++t; --n;
+ if (!n) break;
+ if (*t == ch) break;
+ ++t; --n;
}
return t - s;
}
diff --git a/admin/runit-2.1.2/src/byte_copy.c b/admin/runit-2.1.2/src/byte_copy.c
index 74c9e4a..d33dacd 100644
--- a/admin/runit-2.1.2/src/byte_copy.c
+++ b/admin/runit-2.1.2/src/byte_copy.c
@@ -8,9 +8,13 @@ register unsigned int n;
register char *from;
{
for (;;) {
- if (!n) return; *to++ = *from++; --n;
- if (!n) return; *to++ = *from++; --n;
- if (!n) return; *to++ = *from++; --n;
- if (!n) return; *to++ = *from++; --n;
+ if (!n) return;
+ *to++ = *from++; --n;
+ if (!n) return;
+ *to++ = *from++; --n;
+ if (!n) return;
+ *to++ = *from++; --n;
+ if (!n) return;
+ *to++ = *from++; --n;
}
}
diff --git a/admin/runit-2.1.2/src/byte_cr.c b/admin/runit-2.1.2/src/byte_cr.c
index 52dc251..b17300e 100644
--- a/admin/runit-2.1.2/src/byte_cr.c
+++ b/admin/runit-2.1.2/src/byte_cr.c
@@ -10,9 +10,13 @@ register char *from;
to += n;
from += n;
for (;;) {
- if (!n) return; *--to = *--from; --n;
- if (!n) return; *--to = *--from; --n;
- if (!n) return; *--to = *--from; --n;
- if (!n) return; *--to = *--from; --n;
+ if (!n) return;
+ *--to = *--from; --n;
+ if (!n) return;
+ *--to = *--from; --n;
+ if (!n) return;
+ *--to = *--from; --n;
+ if (!n) return;
+ *--to = *--from; --n;
}
}
diff --git a/admin/runit-2.1.2/src/byte_diff.c b/admin/runit-2.1.2/src/byte_diff.c
index 0c4d17b..7abc766 100644
--- a/admin/runit-2.1.2/src/byte_diff.c
+++ b/admin/runit-2.1.2/src/byte_diff.c
@@ -8,10 +8,18 @@ register unsigned int n;
register char *t;
{
for (;;) {
- if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
- if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
- if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
- if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
+ if (!n) return 0;
+ if (*s != *t) break;
+ ++s; ++t; --n;
+ if (!n) return 0;
+ if (*s != *t) break;
+ ++s; ++t; --n;
+ if (!n) return 0;
+ if (*s != *t) break;
+ ++s; ++t; --n;
+ if (!n) return 0;
+ if (*s != *t) break;
+ ++s; ++t; --n;
}
return ((int)(unsigned int)(unsigned char) *s)
- ((int)(unsigned int)(unsigned char) *t);
diff --git a/admin/runit-2.1.2/src/byte_rchr.c b/admin/runit-2.1.2/src/byte_rchr.c
index 7ea9948..35db62d 100644
--- a/admin/runit-2.1.2/src/byte_rchr.c
+++ b/admin/runit-2.1.2/src/byte_rchr.c
@@ -15,10 +15,18 @@ int c;
t = s;
u = 0;
for (;;) {
- if (!n) break; if (*t == ch) u = t; ++t; --n;
- if (!n) break; if (*t == ch) u = t; ++t; --n;
- if (!n) break; if (*t == ch) u = t; ++t; --n;
- if (!n) break; if (*t == ch) u = t; ++t; --n;
+ if (!n) break;
+ if (*t == ch) u = t;
+ ++t; --n;
+ if (!n) break;
+ if (*t == ch) u = t;
+ ++t; --n;
+ if (!n) break;
+ if (*t == ch) u = t;
+ ++t; --n;
+ if (!n) break;
+ if (*t == ch) u = t;
+ ++t; --n;
}
if (!u) u = t;
return u - s;
diff --git a/admin/runit-2.1.2/src/chpst.c b/admin/runit-2.1.2/src/chpst.c
index 55b5a37..c2845cb 100644
--- a/admin/runit-2.1.2/src/chpst.c
+++ b/admin/runit-2.1.2/src/chpst.c
@@ -310,12 +310,14 @@ int main(int argc, char **argv) {
switch (*optarg) {
case '-':
++optarg;
- if (optarg[scan_ulong(optarg, &ul)]) usage(); nicelvl =ul;
+ if (optarg[scan_ulong(optarg, &ul)]) usage();
+ nicelvl =ul;
nicelvl *=-1;
break;
case '+': ++optarg;
default:
- if (optarg[scan_ulong(optarg, &ul)]) usage(); nicelvl =ul;
+ if (optarg[scan_ulong(optarg, &ul)]) usage();
+ nicelvl =ul;
break;
}
break;
diff --git a/admin/runit-2.1.2/src/str_chr.c b/admin/runit-2.1.2/src/str_chr.c
index 9b467eb..a29d600 100644
--- a/admin/runit-2.1.2/src/str_chr.c
+++ b/admin/runit-2.1.2/src/str_chr.c
@@ -10,10 +10,18 @@ unsigned int str_chr(register const char *s,int c)
ch = c;
t = s;
for (;;) {
- if (!*t) break; if (*t == ch) break; ++t;
- if (!*t) break; if (*t == ch) break; ++t;
- if (!*t) break; if (*t == ch) break; ++t;
- if (!*t) break; if (*t == ch) break; ++t;
+ if (!*t) break;
+ if (*t == ch) break;
+ ++t;
+ if (!*t) break;
+ if (*t == ch) break;
+ ++t;
+ if (!*t) break;
+ if (*t == ch) break;
+ ++t;
+ if (!*t) break;
+ if (*t == ch) break;
+ ++t;
}
return t - s;
}
diff --git a/admin/runit-2.1.2/src/str_len.c b/admin/runit-2.1.2/src/str_len.c
index dedd005..38c6e28 100644
--- a/admin/runit-2.1.2/src/str_len.c
+++ b/admin/runit-2.1.2/src/str_len.c
@@ -8,9 +8,13 @@ unsigned int str_len(const char *s)
t = s;
for (;;) {
- if (!*t) return t - s; ++t;
- if (!*t) return t - s; ++t;
- if (!*t) return t - s; ++t;
- if (!*t) return t - s; ++t;
+ if (!*t) return t - s;
+ ++t;
+ if (!*t) return t - s;
+ ++t;
+ if (!*t) return t - s;
+ ++t;
+ if (!*t) return t - s;
+ ++t;
}
}
diff --git a/admin/runit-2.1.2/src/sv.c b/admin/runit-2.1.2/src/sv.c
index e9c7f21..3553d5b 100644
--- a/admin/runit-2.1.2/src/sv.c
+++ b/admin/runit-2.1.2/src/sv.c
@@ -290,7 +290,8 @@ int main(int argc, char **argv) {
}
}
argv +=optind; argc -=optind;
- if (!(action =*argv++)) usage(); --argc;
+ if (!(action =*argv++)) usage();
+ --argc;
if (!lsb) { service =argv; services =argc; }
if (!*service) usage();
diff --git a/admin/runit-2.1.2/src/svlogd.c b/admin/runit-2.1.2/src/svlogd.c
index 082e20c..7a5720b 100644
--- a/admin/runit-2.1.2/src/svlogd.c
+++ b/admin/runit-2.1.2/src/svlogd.c
@@ -390,13 +390,24 @@ unsigned int ip4_scan(const char *s,char ip[4])
unsigned long u;
len = 0;
- i = scan_ulong(s,&u); if (!i) return 0; ip[0] = u; s += i; len += i;
- if (*s != '.') return 0; ++s; ++len;
- i = scan_ulong(s,&u); if (!i) return 0; ip[1] = u; s += i; len += i;
- 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[0] = u; s += i; len += i;
+ if (*s != '.') return 0;
+ ++s; ++len;
+ i = scan_ulong(s,&u);
+ if (!i) return 0;
+ ip[1] = u; s += i; len += i;
+ 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;
return len;
}
--
2.26.2

View file

@ -0,0 +1,314 @@
From 20feb1e7b96af8fe616ca6a74a7f9526a9a09598 Mon Sep 17 00:00:00 2001
From: "Z. Liu" <zhixu.liu@gmail.com>
Date: Wed, 28 Aug 2024 01:01:24 +0800
Subject: [PATCH 11/20] fix compilation warning(s): -Wimplicit-fallthrough
found by using gcc 13 with CFLAGS: -Wall -Wextra
chpst.c:317:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
317 | case '+': ++optarg;
chpst.c:318:9: note: here
318 | default:
| ^~~~~~~
strerr.h:39:1: warning: this statement may fall through [-Wimplicit-fallthrough=]
39 | strerr_warn((x1),0,0,0,0,0,(se))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
chpst.c:331:15: note: in expansion of macro 'strerr_warn1'
331 | case 'V': strerr_warn1("$Id: f279d44141c981dd7535a12260efcf1ef7beed26 $", 0);
| ^~~~~~~~~~~~
chpst.c:332:5: note: here
332 | case '?': usage();
| ^~~~
chpst.c:461:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
461 | case '?': softlimit_usage();
| ^~~~~~~~~~~~~~~~~
chpst.c:462:5: note: here
462 | case 'a': getlarg(&limita); break;
| ^~~~
runit-init.c:69:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
69 | if ((*argv)[1] == 'V')
| ^
runit-init.c:71:3: note: here
71 | default:
| ^~~~~~~
runsvdir.c:178:20: warning: this statement may fall through [-Wimplicit-fallthrough=]
178 | case 'P': pgrp =1;
| ~~~~~^~
runsvdir.c:179:5: note: here
179 | case '-': ++argv;
| ^~~~
sv.c:158:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
158 | switch(rc) { case -1: if (lsb) done(4); case 0: return(0); }
| ^
sv.c:158:43: note: here
158 | switch(rc) { case -1: if (lsb) done(4); case 0: return(0); }
| ^~~~
sv.c:174:33: warning: this statement may fall through [-Wimplicit-fallthrough=]
174 | if (lsb) switch(rc) { case 1: done(0); case 2: done(3); case 0: done(4); }
| ^~~~~~~
sv.c:174:42: note: here
174 | if (lsb) switch(rc) { case 1: done(0); case 2: done(3); case 0: done(4); }
| ^~~~
sv.c:174:50: warning: this statement may fall through [-Wimplicit-fallthrough=]
174 | if (lsb) switch(rc) { case 1: done(0); case 2: done(3); case 0: done(4); }
| ^~~~~~~
sv.c:174:59: note: here
174 | if (lsb) switch(rc) { case 1: done(0); case 2: done(3); case 0: done(4); }
| ^~~~
sv.c: In function 'main':
sv.c:286:15: warning: this statement may fall through [-Wimplicit-fallthrough=]
286 | case 'w': scan_ulong(optarg, &wait);
| ^~~~~~~~~~~~~~~~~~~~~~~~~
sv.c:287:5: note: here
287 | case 'v': verbose =1; break;
| ^~~~
In file included from sv.c:5:
strerr.h:39:1: warning: this statement may fall through [-Wimplicit-fallthrough=]
39 | strerr_warn((x1),0,0,0,0,0,(se))
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sv.c:288:15: note: in expansion of macro 'strerr_warn1'
288 | case 'V': strerr_warn1(VERSION, 0);
| ^~~~~~~~~~~~
sv.c:289:5: note: here
289 | case '?': usage();
| ^~~~
sv.c:314:8: warning: this statement may fall through [-Wimplicit-fallthrough=]
314 | if (!str_diff(action, "try-restart")) { acts ="tc"; cbk =&check; break; }
| ^
sv.c:315:3: note: here