Accepting request 65242 from Base:System

Accepted submit request 65242 from user licensedigger

OBS-URL: https://build.opensuse.org/request/show/65242
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/sysvinit?expand=0&rev=108
This commit is contained in:
Sascha Peilicke 2011-03-28 08:27:33 +00:00 committed by Git OBS Bridge
commit e13ff044e4
6 changed files with 24 additions and 133 deletions

View File

@ -1,127 +0,0 @@
--- blogd.c
+++ blogd.c 2011-03-02 11:25:01.151926991 +0000
@@ -301,9 +301,16 @@ int main(int argc, char *argv[])
secondtty(cons, st.st_rdev);
(void)ioctl(0, TIOCCONS, NULL); /* Undo any current map if any */
+ close(0);
+
if (ioctl(pts, TIOCCONS, NULL) < 0)
error("can not set console device to %s: %s\n", ptsname, strerror(errno));
+ dup2(pts, 1);
+ dup2(pts, 2);
+ if (pts > 2)
+ close(pts);
+
for (c = cons; c; c = c->next) {
#ifdef _PC_MAX_CANON
if ((c->max_canon = (ssize_t)fpathconf(c->fd, _PC_MAX_CANON)) <= 0)
@@ -356,21 +363,16 @@ int main(int argc, char *argv[])
close(cons->fd);
cons->fd = 1; /* Choose stdout */
}
- close(pts);
close(ptm);
break;
case -1:
- close(pts);
close(ptm);
warn("can not fork to become daemon: %s\n", strerror(errno));
goto err;
default:
time(&tt);
stt = ctime(&tt);
- close(pts);
close(ptm);
- close(cons->fd);
- cons->fd = -1;
for (c = cons; c; c = c->next) {
if (c->fd > 0) {
close(c->fd);
--- libconsole.c
+++ libconsole.c 2011-03-02 10:33:17.032457114 +0000
@@ -707,11 +707,12 @@ static void parselog(unsigned char *buf,
static void copylog(const unsigned char *buf, const size_t s)
{
lock(&llock);
- if (!nl) {
+ if (!nl)
addlog('\n');
- nl = 1;
- }
storelog(buf, s);
+ if (buf[s-1] != '\n')
+ addlog('\n');
+ nl = 1;
unlock(&llock);
}
@@ -770,7 +771,7 @@ void prepareIO(void (*rfunc)(int), void
(void)mkfifo(fifo_name, 0600);
errno = 0;
if (!stat(fifo_name, &st) && S_ISFIFO(st.st_mode)) {
- if ((fdfifo = open(fifo_name, O_RDONLY|O_NOCTTY|O_CLOEXEC)) < 0)
+ if ((fdfifo = open(fifo_name, O_RDWR|O_NOCTTY|O_CLOEXEC)) < 0)
warn("can not open named fifo %s: %s\n", fifo_name, strerror(errno));
}
}
@@ -1266,7 +1267,7 @@ char * fetchtty(const pid_t pid, const p
while ((fscanf(fc, "%*s %*s (%[^)]) %d:%d", &fbuf[0], &maj, &min) == 3)) {
if (!strchr(fbuf, 'E'))
continue;
- if (strchr(fbuf, '*')) {
+ if (strchr(fbuf, 'C')) {
dev = makedev(maj, min);
break;
}
@@ -1327,8 +1328,9 @@ void secondtty(struct console *restrict
tail = cons;
- if ((fc = fopen("/proc/tty/consoles", "r"))) {
- int maj, min, flags;
+ if ((fc = fopen("/proc/consoles", "r"))) {
+ unsigned int maj, min;
+ int flags;
struct stat st;
char fbuf[16];
@@ -1341,13 +1343,13 @@ void secondtty(struct console *restrict
error("can not opendir(/dev): %s\n", strerror(errno));
pushd("/dev");
- while ((fscanf(fc, "%*s %*s (%[^)]) %d:%d", &fbuf[0], &maj, &min) == 3)) {
+ while ((fscanf(fc, "%*s %*s (%[^)]) %u:%u", &fbuf[0], &maj, &min) == 3)) {
struct console *restrict newc;
dev_t dev;
if (!strchr(fbuf, 'E'))
continue;
- if (strchr(fbuf, '*'))
+ if (strchr(fbuf, 'C'))
continue;
dev = makedev(maj, min);
--- showconsole.8
+++ showconsole.8 2010-11-09 15:26:29.038362757 +0000
@@ -22,8 +22,7 @@ Setconsole \- redirect system console ou
.SH DESCRIPTION
.B showconsole
determines the real character device of
-the current
-.BR stdin.
+the current system console.
This can be used on
.I /dev/console
as current character device to
--- showconsole.c
+++ showconsole.c 2010-10-25 13:08:25.583937937 +0000
@@ -19,6 +19,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
+#include <signal.h>
#include "libconsole.h"
/*

View File

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

4
showconsole-1.14.dif Normal file
View File

@ -0,0 +1,4 @@
--- .dummy
+++ .dummy 2011-03-25 17:58:16.867926297 +0000
@@ -0,0 +1 @@
+Remove if real patch is required

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

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

View File

@ -1,3 +1,17 @@
-------------------------------------------------------------------
Fri Mar 25 18:59:05 CET 2011 - werner@suse.de
- New showconsole verion 1.14
* Use sysfs file as fallback if possible
* Add more sanity checks to avoid looping on tty0
-------------------------------------------------------------------
Fri Mar 25 12:13:30 CET 2011 - werner@suse.de
- Fix triggered endless loop in blogd (bnc#642289)
* Writing on tty0 caused blogd to re-read its own messages
* The usage of ttyname(3) on /dev/console can fail
-------------------------------------------------------------------
Tue Mar 15 16:01:22 CET 2011 - werner@suse.de

View File

@ -22,7 +22,7 @@ Name: sysvinit
%define MGVER 0.9.6s
%define PDVER 2.0.2
%define KPVER 2.19
%define SCVER 1.13
%define SCVER 1.14
%define SIVER 2.88+
%define START 0.57
License: GPLv2+
@ -37,7 +37,7 @@ Url: http://savannah.nongnu.org/projects/sysvinit/
Source: http://download.savannah.gnu.org/releases/sysvinit/sysvinit-2.88+dsf.tar.bz2
Source2: killproc-2.19.tar.bz2
Source3: powerd-2.0.2.tar.bz2
Source4: showconsole-1.13.tar.bz2
Source4: showconsole-1.14.tar.bz2
Source5: startpar-0.57.tar.bz2
Source6: rc.powerd
Source7: sysvinit-rpmlintrc
@ -52,7 +52,7 @@ Patch4: notify-pam-dead.patch
Patch20: powerd-2.0.2.dif
Patch21: powerd-2.0.2-getaddrinfo.patch
Patch30: killproc-2.19.dif
Patch40: showconsole-1.13.dif
Patch40: showconsole-1.14.dif
Patch50: startpar-0.57.dif
Requires: sysvinit-tools
Provides: sbin_init