Dr. Werner Fink 2011-10-17 12:36:23 +00:00 committed by Git OBS Bridge
parent 5b7eabb5e9
commit 82d65def45
8 changed files with 136 additions and 23 deletions

10
showconsole-1.15.dif Normal file
View File

@ -0,0 +1,10 @@
--- showconsole.8
+++ showconsole.8 2011-09-08 15:13:48.000000000 +0000
@@ -8,7 +8,6 @@
.\"
.TH SHOWCONSOLE 8 "Nov 10, 2000" "Version 1.16" "The SuSE boot concept"
.UC 8
-.OS SuSE Linux
.SH NAME
Showconsole \- determines the real tty of stdin
.br

3
showconsole-1.15.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:24074b56e133f3136b9654a6e5950d8582b9e6cf7c4e8af5bf4cc09728db6028
size 25634

View File

@ -1,4 +0,0 @@
--- .#nothing
+++ .#nothing 2011-09-01 11:59:52.000000000 +0000
@@ -0,0 +1 @@
+Please remove if patched

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fdd26fc738b8d7e7002a4ad2c7247202ef7993aff8db82df39f88f0ce134459e
size 30243

View File

@ -1,6 +1,6 @@
--- src/killall5.c
+++ src/killall5.c 2010-03-19 14:29:44.000000000 +0000
@@ -444,6 +444,38 @@ int readarg(FILE *fp, char *buf, int sz)
+++ src/killall5.c 2011-10-17 12:11:32.000000000 +0000
@@ -454,6 +454,38 @@ int readarg(FILE *fp, char *buf, int sz)
}
/*
@ -39,15 +39,7 @@
* Read the proc filesystem.
* CWD must be /proc to avoid problems if / is affected by the killing (ie depend on fuse).
*/
@@ -458,6 +490,7 @@ int readproc(int do_stat)
char buf[PATH_MAX+1];
char *s, *q;
unsigned long startcode, endcode;
+ ssize_t len;
int pid, f;
/* Open the /proc directory. */
@@ -608,6 +641,26 @@ int readproc(int do_stat)
@@ -634,6 +666,26 @@ int readproc(int do_stat)
p->nfs = 0;
switch (do_stat) {
@ -73,4 +65,4 @@
+ break;
case DO_NETFS:
if ((p->nfs = check4nfs(path, buf)))
break;
goto link;

View File

@ -0,0 +1,106 @@
--- src/killall5.c
+++ src/killall5.c 2011-10-17 12:18:06.455147132 +0000
@@ -469,6 +469,7 @@ int readproc(int do_stat)
char *s, *q;
unsigned long startcode, endcode;
int pid, f;
+ ssize_t len;
/* Open the /proc directory. */
if (chdir("/proc") == -1) {
@@ -635,23 +636,22 @@ int readproc(int do_stat)
switch (do_stat) {
case DO_NETFS:
if ((p->nfs = check4nfs(path, buf)))
- break;
+ goto link;
case DO_STAT:
if (stat(path, &st) != 0)
break;
- else {
- char buf[PATH_MAX];
-
- f = readlink(path, buf, sizeof buf);
- if (f > 0) {
- p->pathname = (char *)xmalloc(f + 1);
- memcpy(p->pathname, buf, f);
- p->pathname[f] = '\0';
- }
- }
p->dev = st.st_dev;
p->ino = st.st_ino;
+
+ /* Fall through */
default:
+ link:
+ len = readlink(path, buf, PATH_MAX);
+ if (len > 0) {
+ p->pathname = (char *)xmalloc(len + 1);
+ memcpy(p->pathname, buf, len);
+ p->pathname[len] = '\0';
+ }
break;
}
@@ -722,6 +722,7 @@ PIDQ_HEAD *pidof(char *prog)
int dostat = 0;
int foundone = 0;
int ok = 0;
+ const int root = (getuid() == 0);
char real[PATH_MAX+1];
if (! prog)
@@ -769,16 +770,11 @@ PIDQ_HEAD *pidof(char *prog)
* network FS located binaries */
if (!foundone && nfs) {
for (p = plist; p; p = p->next) {
- char exe [PATH_MAX+1];
- char path[PATH_MAX+1];
- int len;
+ if (!p->pathname)
+ continue;
if (!p->nfs)
continue;
- snprintf(exe, sizeof(exe), "/proc/%d/exe", p->pid);
- if ((len = readlink(exe, path, PATH_MAX)) < 0)
- continue;
- path[len] = '\0';
- if (strcmp(prog, path) != 0)
+ if (strcmp(prog, p->pathname) != 0)
continue;
add_pid_to_q(q, p);
foundone++;
@@ -788,19 +784,31 @@ PIDQ_HEAD *pidof(char *prog)
/* If we didn't find a match based on dev/ino, try the name. */
if (!foundone) for (p = plist; p; p = p->next) {
if (prog[0] == '/') {
- if (!p->pathname)
- continue;
+ if (!p->pathname) {
+ if (root)
+ continue;
+ goto fallback;
+ }
if (strcmp(prog, p->pathname)) {
int len = strlen(prog);
if (strncmp(prog, p->pathname, len))
+ {
+ if (scripts_too)
+ goto fallback;
continue;
+ }
if (strcmp(" (deleted)", p->pathname + len))
+ {
+ if (scripts_too)
+ goto fallback;
continue;
+ }
}
add_pid_to_q(q, p);
continue;
}
+ fallback:
ok = 0;
/* matching nonmatching

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Oct 17 09:08:36 UTC 2011 - werner@suse.de
- There was never a version 1.16 for showconsole
- Add some code to be able to detect programs even as user with
kernel 3.0 and above (bnc#723072)
-------------------------------------------------------------------
Tue Oct 11 13:46:46 UTC 2011 - coolo@suse.com

View File

@ -22,7 +22,7 @@ Name: sysvinit
%define MGVER 0.9.6s
%define PDVER 2.0.2
%define KPVER 2.20
%define SCVER 1.16
%define SCVER 1.15
%define SIVER 2.88+
%define START 0.57
License: GPLv2+
@ -36,7 +36,7 @@ Url: http://savannah.nongnu.org/projects/sysvinit/
Source: http://download.savannah.gnu.org/releases/sysvinit/sysvinit-%{SIVER}dsf.tar.bz2
Source2: killproc-%{KPVER}.tar.bz2
Source3: powerd-%{PDVER}.tar.bz2
Source4: showconsole-%{SCVER}.tar.gz
Source4: showconsole-%{SCVER}.tar.bz2
Source5: startpar-%{START}.tar.bz2
Source6: rc.powerd
Source7: %{name}-rpmlintrc
@ -46,12 +46,13 @@ Source10: mkinitrd-kill2.sh
Patch: %{name}-%{version}dsf.dif
Patch1: %{name}-2.82-startstop.patch
Patch2: %{name}-2.88dsf-suse.patch
Patch3: %{name}-2.88dsf-no-kill.patch
Patch3: %{name}-2.88dsf-scripts2.patch
Patch4: notify-pam-dead.patch
Patch5: %{name}-2.88dsf-multiple-sulogin.patch
Patch6: %{name}-%{version}dsf-run.diff
Patch7: %{name}-%{version}dsf-crypt.patch
Patch8: %{name}-%{version}dsf-blowfish.dif
Patch9: %{name}-2.88dsf-no-kill.patch
Patch20: powerd-%{PDVER}.dif
Patch21: powerd-%{PDVER}-getaddrinfo.patch
Patch30: killproc-%{KPVER}.dif
@ -96,12 +97,13 @@ Just some symlinks
%setup -n %{name}-%{SIVER}dsf -q -b 2 -b 3 -b 4 -b 5
%patch1 -p0 -b .startstop
%patch2 -p0 -b .suse
%patch3 -p0 -b .no-kill
%patch3 -p0 -b .scripts2
%patch4 -p0 -b .pam
%patch5 -p0 -b .sulogin
%patch6 -p0 -b .run
%patch7 -p0 -b .crypt
%patch8 -p0 -b .blowfish
%patch9 -p0 -b .no-kill
%patch
pushd doc
mkdir killproc powerd showconsole