.
OBS-URL: https://build.opensuse.org/package/show/Base:System/sysvinit?expand=0&rev=122
This commit is contained in:
parent
21e3e4d8dc
commit
83457e257d
@ -10,7 +10,7 @@
|
|||||||
.B blogd
|
.B blogd
|
||||||
needs a mounted
|
needs a mounted
|
||||||
--- blogd.c
|
--- blogd.c
|
||||||
+++ blogd.c 2011-04-19 11:59:52.736425469 +0000
|
+++ blogd.c 2011-04-20 11:13:46.799926099 +0000
|
||||||
@@ -41,6 +41,7 @@
|
@@ -41,6 +41,7 @@
|
||||||
# define _POSIX_MAX_CANON 255
|
# define _POSIX_MAX_CANON 255
|
||||||
#endif
|
#endif
|
||||||
@ -36,7 +36,18 @@
|
|||||||
|
|
||||||
static void sighandle(int sig)
|
static void sighandle(int sig)
|
||||||
{
|
{
|
||||||
@@ -336,7 +336,7 @@ int main(int argc, char *argv[])
|
@@ -318,6 +318,10 @@ int main(int argc, char *argv[])
|
||||||
|
cfmakeraw(&o);
|
||||||
|
cfsetispeed(&o, ispeed);
|
||||||
|
cfsetospeed(&o, ospeed);
|
||||||
|
+ o.c_lflag &= ~ECHO;
|
||||||
|
+ o.c_lflag |= ISIG;
|
||||||
|
+ o.c_cc[VTIME] = 0;
|
||||||
|
+ o.c_cc[VMIN] = CMIN;
|
||||||
|
|
||||||
|
if (openpty(&ptm, &pts, ptsname, &o, &w) < 0)
|
||||||
|
error("can not open pty/tty pair: %m\n");
|
||||||
|
@@ -336,7 +340,7 @@ int main(int argc, char *argv[])
|
||||||
dup2(0, 2);
|
dup2(0, 2);
|
||||||
|
|
||||||
secondtty(cons, st.st_rdev);
|
secondtty(cons, st.st_rdev);
|
||||||
@ -45,7 +56,28 @@
|
|||||||
(void)ioctl(0, TIOCCONS, NULL); /* Undo any current map if any */
|
(void)ioctl(0, TIOCCONS, NULL); /* Undo any current map if any */
|
||||||
close(0);
|
close(0);
|
||||||
|
|
||||||
@@ -351,22 +351,34 @@ exit(0);
|
@@ -344,6 +348,20 @@ exit(0);
|
||||||
|
error("can not set console device to %s: %m\n", ptsname);
|
||||||
|
close(pts);
|
||||||
|
|
||||||
|
+ signaled = nsigsys = 0;
|
||||||
|
+ set_signal(SIGTTIN, &saved_sigttin, SIG_IGN);
|
||||||
|
+ set_signal(SIGTTOU, &saved_sigttou, SIG_IGN);
|
||||||
|
+ set_signal(SIGTSTP, &saved_sigtstp, SIG_IGN);
|
||||||
|
+ set_signal(SIGHUP, &saved_sighup, SIG_IGN);
|
||||||
|
+ set_signal(SIGINT, &saved_sigint, sighandle);
|
||||||
|
+ set_signal(SIGQUIT, &saved_sigquit, sighandle);
|
||||||
|
+ set_signal(SIGTERM, &saved_sigterm, sighandle);
|
||||||
|
+ set_signal(SIGSYS, &saved_sigsys, sigsys);
|
||||||
|
+ (void)siginterrupt(SIGINT, 0);
|
||||||
|
+ (void)siginterrupt(SIGQUIT, 0);
|
||||||
|
+ (void)siginterrupt(SIGTERM, 0);
|
||||||
|
+ (void)siginterrupt(SIGSYS, 0);
|
||||||
|
+
|
||||||
|
for (c = cons; c; c = c->next) {
|
||||||
|
int iflag, oflag;
|
||||||
|
#ifdef _PC_MAX_CANON
|
||||||
|
@@ -351,22 +369,34 @@ exit(0);
|
||||||
#endif
|
#endif
|
||||||
c->max_canon = _POSIX_MAX_CANON;
|
c->max_canon = _POSIX_MAX_CANON;
|
||||||
c->tlock = 0;
|
c->tlock = 0;
|
||||||
@ -88,16 +120,28 @@
|
|||||||
if ((c->otio.c_lflag & ICANON) == 0) {
|
if ((c->otio.c_lflag & ICANON) == 0) {
|
||||||
c->otio.c_lflag |= ICANON | IEXTEN | ISIG | ECHO|ECHOE|ECHOK|ECHOKE;
|
c->otio.c_lflag |= ICANON | IEXTEN | ISIG | ECHO|ECHOE|ECHOK|ECHOKE;
|
||||||
c->otio.c_oflag |= OPOST;
|
c->otio.c_oflag |= OPOST;
|
||||||
@@ -384,7 +396,7 @@ exit(0);
|
@@ -384,20 +414,6 @@ exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- nsigsys = 0;
|
- nsigsys = 0;
|
||||||
+ signaled = nsigsys = 0;
|
- set_signal(SIGTTIN, &saved_sigttin, SIG_IGN);
|
||||||
set_signal(SIGTTIN, &saved_sigttin, SIG_IGN);
|
- set_signal(SIGTTOU, &saved_sigttou, SIG_IGN);
|
||||||
set_signal(SIGTTOU, &saved_sigttou, SIG_IGN);
|
- set_signal(SIGTSTP, &saved_sigtstp, SIG_IGN);
|
||||||
set_signal(SIGTSTP, &saved_sigtstp, SIG_IGN);
|
- set_signal(SIGHUP, &saved_sighup, SIG_IGN);
|
||||||
@@ -427,7 +439,7 @@ exit(0);
|
- set_signal(SIGINT, &saved_sigint, sighandle);
|
||||||
|
- set_signal(SIGQUIT, &saved_sigquit, sighandle);
|
||||||
|
- set_signal(SIGTERM, &saved_sigterm, sighandle);
|
||||||
|
- set_signal(SIGSYS, &saved_sigsys, sigsys);
|
||||||
|
- (void)siginterrupt(SIGINT, 0);
|
||||||
|
- (void)siginterrupt(SIGQUIT, 0);
|
||||||
|
- (void)siginterrupt(SIGTERM, 0);
|
||||||
|
- (void)siginterrupt(SIGSYS, 0);
|
||||||
|
-
|
||||||
|
atexit(exit_handler); /* Register main exit handler */
|
||||||
|
|
||||||
|
switch ((pid = fork())) {
|
||||||
|
@@ -427,7 +443,7 @@ exit(0);
|
||||||
}
|
}
|
||||||
fprintf(stdout, "\rBoot logging started on %s(%s) at %.24s\n", tty, console, stt);
|
fprintf(stdout, "\rBoot logging started on %s(%s) at %.24s\n", tty, console, stt);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
@ -106,7 +150,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
atexit(flush_handler); /* Register flush exit handler */
|
atexit(flush_handler); /* Register flush exit handler */
|
||||||
@@ -436,7 +448,7 @@ exit(0);
|
@@ -436,7 +452,7 @@ exit(0);
|
||||||
while (!signaled)
|
while (!signaled)
|
||||||
safeIO();
|
safeIO();
|
||||||
|
|
||||||
@ -127,11 +171,16 @@
|
|||||||
.TP
|
.TP
|
||||||
.I /dev/console
|
.I /dev/console
|
||||||
--- libconsole.c
|
--- libconsole.c
|
||||||
+++ libconsole.c 2011-04-19 12:16:38.307927219 +0000
|
+++ libconsole.c 2011-04-20 11:13:46.815926166 +0000
|
||||||
@@ -59,6 +59,22 @@
|
@@ -59,6 +59,27 @@
|
||||||
#include "listing.h"
|
#include "listing.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
+ * Used to ignore some signals during pselect(2)
|
||||||
|
+ */
|
||||||
|
+static sigset_t omask;
|
||||||
|
+
|
||||||
|
+/*
|
||||||
+ * Remember if we're signaled.
|
+ * Remember if we're signaled.
|
||||||
+ */
|
+ */
|
||||||
+volatile sig_atomic_t signaled;
|
+volatile sig_atomic_t signaled;
|
||||||
@ -151,7 +200,7 @@
|
|||||||
* push and popd direcotry changes
|
* push and popd direcotry changes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -182,7 +198,9 @@ static inline void safeout (int fd, cons
|
@@ -182,7 +203,9 @@ static inline void safeout (int fd, cons
|
||||||
if (p < 0) {
|
if (p < 0) {
|
||||||
if (errno == EPIPE) {
|
if (errno == EPIPE) {
|
||||||
warn("error on writing to fd %d: %m\n", fd);
|
warn("error on writing to fd %d: %m\n", fd);
|
||||||
@ -162,7 +211,7 @@
|
|||||||
}
|
}
|
||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
@@ -192,8 +210,9 @@ static inline void safeout (int fd, cons
|
@@ -192,8 +215,9 @@ static inline void safeout (int fd, cons
|
||||||
int ret;
|
int ret;
|
||||||
fd_set check;
|
fd_set check;
|
||||||
|
|
||||||
@ -174,7 +223,14 @@
|
|||||||
|
|
||||||
FD_ZERO (&check);
|
FD_ZERO (&check);
|
||||||
FD_SET (fd, &check);
|
FD_SET (fd, &check);
|
||||||
@@ -206,25 +225,28 @@ static inline void safeout (int fd, cons
|
@@ -201,30 +225,33 @@ static inline void safeout (int fd, cons
|
||||||
|
/* Avoid high load: wait upto two seconds if system is not ready */
|
||||||
|
errno = 0;
|
||||||
|
do {
|
||||||
|
- struct timeval two = {2, 0};
|
||||||
|
- ret = select(fd + 1, (fd_set*)0, &check, (fd_set*)0, &two);
|
||||||
|
+ struct timespec two = {2, 0};
|
||||||
|
+ ret = pselect(fd + 1, (fd_set*)0, &check, (fd_set*)0, &two, &omask);
|
||||||
|
|
||||||
} while ((ret < 0) && (errno == EINTR));
|
} while ((ret < 0) && (errno == EINTR));
|
||||||
|
|
||||||
@ -208,7 +264,24 @@
|
|||||||
errno = saveerr;
|
errno = saveerr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,11 +282,11 @@ static inline ssize_t safein (int fd, ch
|
@@ -244,14 +271,14 @@ static inline ssize_t safein (int fd, ch
|
||||||
|
t=0;
|
||||||
|
if ((ioctl(fd, FIONREAD, &t) < 0) || (t == 0)) {
|
||||||
|
fd_set check;
|
||||||
|
- struct timeval zero = {0, 0};
|
||||||
|
+ struct timespec zero = {0, 0};
|
||||||
|
|
||||||
|
do {
|
||||||
|
FD_ZERO (&check);
|
||||||
|
FD_SET (fd, &check);
|
||||||
|
|
||||||
|
/* Avoid deadlock: do not read if nothing is in there */
|
||||||
|
- if (select(fd + 1, &check, (fd_set*)0, (fd_set*)0, &zero) <= 0)
|
||||||
|
+ if (pselect(fd + 1, &check, (fd_set*)0, (fd_set*)0, &zero, &omask) <= 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
r = read (fd, ptr, s);
|
||||||
|
@@ -260,11 +287,11 @@ static inline ssize_t safein (int fd, ch
|
||||||
|
|
||||||
/* Do not exit on a broken FIFO */
|
/* Do not exit on a broken FIFO */
|
||||||
if (r < 0 && errno != EPIPE) {
|
if (r < 0 && errno != EPIPE) {
|
||||||
@ -222,7 +295,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
goto out;
|
goto out;
|
||||||
@@ -277,17 +299,18 @@ static inline ssize_t safein (int fd, ch
|
@@ -277,17 +304,18 @@ static inline ssize_t safein (int fd, ch
|
||||||
while (t > 0) {
|
while (t > 0) {
|
||||||
ssize_t p = read (fd, ptr, t);
|
ssize_t p = read (fd, ptr, t);
|
||||||
if (p < 0) {
|
if (p < 0) {
|
||||||
@ -245,7 +318,7 @@
|
|||||||
}
|
}
|
||||||
repeated = 0;
|
repeated = 0;
|
||||||
ptr += p;
|
ptr += p;
|
||||||
@@ -302,7 +325,7 @@ out:
|
@@ -302,7 +330,7 @@ out:
|
||||||
/*
|
/*
|
||||||
* The stdio file pointer for our log file
|
* The stdio file pointer for our log file
|
||||||
*/
|
*/
|
||||||
@ -254,7 +327,7 @@
|
|||||||
static FILE * flog = NULL;
|
static FILE * flog = NULL;
|
||||||
static int fdread = -1;
|
static int fdread = -1;
|
||||||
static int fdfifo = -1;
|
static int fdfifo = -1;
|
||||||
@@ -310,7 +333,7 @@ static int fdfifo = -1;
|
@@ -310,7 +338,7 @@ static int fdfifo = -1;
|
||||||
/*
|
/*
|
||||||
* Signal control for writing on log file
|
* Signal control for writing on log file
|
||||||
*/
|
*/
|
||||||
@ -263,7 +336,7 @@
|
|||||||
static volatile sig_atomic_t nsigio = -1;
|
static volatile sig_atomic_t nsigio = -1;
|
||||||
static sigset_t save_oldset;
|
static sigset_t save_oldset;
|
||||||
|
|
||||||
@@ -402,7 +425,7 @@ xout:
|
@@ -402,7 +430,7 @@ xout:
|
||||||
static inline void writelog(void)
|
static inline void writelog(void)
|
||||||
{
|
{
|
||||||
if (!flog)
|
if (!flog)
|
||||||
@ -272,7 +345,7 @@
|
|||||||
clearerr(flog);
|
clearerr(flog);
|
||||||
lock(&llock);
|
lock(&llock);
|
||||||
while (avail > 0) {
|
while (avail > 0) {
|
||||||
@@ -412,7 +435,7 @@ static inline void writelog(void)
|
@@ -412,7 +440,7 @@ static inline void writelog(void)
|
||||||
ret = TRANS_BUFFER_SIZE;
|
ret = TRANS_BUFFER_SIZE;
|
||||||
|
|
||||||
if (!flog)
|
if (!flog)
|
||||||
@ -281,7 +354,7 @@
|
|||||||
ret = fwrite(head, sizeof(unsigned char), ret, flog);
|
ret = fwrite(head, sizeof(unsigned char), ret, flog);
|
||||||
if (!ret && ferror(flog))
|
if (!ret && ferror(flog))
|
||||||
break;
|
break;
|
||||||
@@ -429,12 +452,10 @@ static inline void writelog(void)
|
@@ -429,12 +457,10 @@ static inline void writelog(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unlock(&llock);
|
unlock(&llock);
|
||||||
@ -298,16 +371,63 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void flushlog(void)
|
static inline void flushlog(void)
|
||||||
@@ -808,7 +829,7 @@ static void more_input (struct timeval *
|
@@ -771,6 +797,12 @@ void prepareIO(void (*rfunc)(int), void
|
||||||
if (nfds < 0) {
|
pgroup = pgrp;
|
||||||
|
fdread = in;
|
||||||
|
|
||||||
|
+ (void)sigfillset(&omask);
|
||||||
|
+ (void)sigdelset(&omask, SIGQUIT);
|
||||||
|
+ (void)sigdelset(&omask, SIGTERM);
|
||||||
|
+ (void)sigdelset(&omask, SIGSYS);
|
||||||
|
+ (void)sigdelset(&omask, SIGIO);
|
||||||
|
+
|
||||||
|
if (fifo_name && fdfifo < 0) {
|
||||||
|
struct stat st;
|
||||||
|
errno = 0;
|
||||||
|
@@ -789,7 +821,7 @@ void prepareIO(void (*rfunc)(int), void
|
||||||
|
/*
|
||||||
|
* Seek for input, more input ...
|
||||||
|
*/
|
||||||
|
-static void more_input (struct timeval *timeout, const int noerr)
|
||||||
|
+static void more_input (struct timespec *timeout, const int noerr)
|
||||||
|
{
|
||||||
|
fd_set watch;
|
||||||
|
int nfds, wfds;
|
||||||
|
@@ -803,19 +835,16 @@ static void more_input (struct timeval *
|
||||||
|
} else
|
||||||
|
wfds = fdread + 1;
|
||||||
|
|
||||||
|
- nfds = select(wfds, &watch, (fd_set*)0, (fd_set*)0, timeout);
|
||||||
|
+ nfds = pselect(wfds, &watch, (fd_set*)0, (fd_set*)0, timeout, &omask);
|
||||||
|
|
||||||
|
- if (nfds < 0) {
|
||||||
|
+ if (nfds <= 0) {
|
||||||
timeout->tv_sec = 0;
|
timeout->tv_sec = 0;
|
||||||
timeout->tv_usec = 0;
|
- timeout->tv_usec = 0;
|
||||||
- if (errno != EINTR)
|
- if (errno != EINTR)
|
||||||
+ if (errno != EINTR && !signaled)
|
- error ("select(): %m\n");
|
||||||
error ("select(): %m\n");
|
+ timeout->tv_nsec = 0;
|
||||||
|
+ if (nfds < 0 && errno != EINTR && !signaled)
|
||||||
|
+ error ("pselect(): %m\n");
|
||||||
goto nothing;
|
goto nothing;
|
||||||
}
|
}
|
||||||
@@ -898,8 +919,12 @@ void safeIO (void)
|
|
||||||
|
- if (!nfds)
|
||||||
|
- goto nothing;
|
||||||
|
-
|
||||||
|
if (FD_ISSET(fdread, &watch)) {
|
||||||
|
const ssize_t cnt = safein(fdread, (char*)trans, sizeof(trans), noerr);
|
||||||
|
static struct winsize owz;
|
||||||
|
@@ -863,7 +892,7 @@ nothing:
|
||||||
|
*/
|
||||||
|
void safeIO (void)
|
||||||
|
{
|
||||||
|
- struct timeval timeout;
|
||||||
|
+ struct timespec timeout;
|
||||||
|
static int log = -1;
|
||||||
|
|
||||||
|
if (!nsigio) /* signal handler set but no signal recieved */
|
||||||
|
@@ -898,8 +927,12 @@ void safeIO (void)
|
||||||
(*vr_access)();
|
(*vr_access)();
|
||||||
vr_access = NULL;
|
vr_access = NULL;
|
||||||
}
|
}
|
||||||
@ -322,7 +442,40 @@
|
|||||||
|
|
||||||
nsigio = SIGIO; /* We do not need a signal handler */
|
nsigio = SIGIO; /* We do not need a signal handler */
|
||||||
(void)signal(SIGIO, SIG_IGN);
|
(void)signal(SIGIO, SIG_IGN);
|
||||||
@@ -998,20 +1023,16 @@ void closeIO(void)
|
@@ -927,7 +960,7 @@ skip:
|
||||||
|
}
|
||||||
|
|
||||||
|
timeout.tv_sec = 5;
|
||||||
|
- timeout.tv_usec = 0;
|
||||||
|
+ timeout.tv_nsec = 0;
|
||||||
|
more_input(&timeout, 0);
|
||||||
|
|
||||||
|
if (flog && !running) {
|
||||||
|
@@ -958,7 +991,7 @@ skip:
|
||||||
|
*/
|
||||||
|
void closeIO(void)
|
||||||
|
{
|
||||||
|
- struct timeval timeout;
|
||||||
|
+ struct timespec timeout;
|
||||||
|
struct console * c;
|
||||||
|
int n = 240;
|
||||||
|
|
||||||
|
@@ -983,12 +1016,12 @@ void closeIO(void)
|
||||||
|
n--;
|
||||||
|
|
||||||
|
timeout.tv_sec = 0;
|
||||||
|
- timeout.tv_usec = 25*1000;
|
||||||
|
+ timeout.tv_nsec = 25*1000*1000;
|
||||||
|
|
||||||
|
more_input(&timeout, 1);
|
||||||
|
(void)tcdrain(fdread);
|
||||||
|
|
||||||
|
- } while (timeout.tv_sec || timeout.tv_usec);
|
||||||
|
+ } while (timeout.tv_sec || timeout.tv_nsec);
|
||||||
|
|
||||||
|
if (running) {
|
||||||
|
lock(&ljoin);
|
||||||
|
@@ -998,20 +1031,16 @@ void closeIO(void)
|
||||||
pthread_cancel(lthread);
|
pthread_cancel(lthread);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,7 +505,7 @@
|
|||||||
if (fdfifo >= 0) {
|
if (fdfifo >= 0) {
|
||||||
close(fdfifo);
|
close(fdfifo);
|
||||||
fdfifo = -1;
|
fdfifo = -1;
|
||||||
@@ -1101,7 +1122,7 @@ static dev_t fallback(const pid_t pid, c
|
@@ -1101,7 +1130,7 @@ static dev_t fallback(const pid_t pid, c
|
||||||
|
|
||||||
printf("|%u|%u|", tty, ttypgrp); /* stdout to pipe synchronize ... */
|
printf("|%u|%u|", tty, ttypgrp); /* stdout to pipe synchronize ... */
|
||||||
|
|
||||||
@ -361,7 +514,7 @@
|
|||||||
} break;
|
} break;
|
||||||
case -1:
|
case -1:
|
||||||
error("can not execute: %m\n");
|
error("can not execute: %m\n");
|
||||||
@@ -1463,6 +1484,10 @@ static void consalloc(struct console *re
|
@@ -1463,6 +1492,10 @@ static void consalloc(struct console *re
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tail->next = newc;
|
tail->next = newc;
|
||||||
|
@ -121,7 +121,7 @@
|
|||||||
-extern void unraw_consoles(void);
|
-extern void unraw_consoles(void);
|
||||||
-extern void raw_consoles(void);
|
-extern void raw_consoles(void);
|
||||||
--- startpar.c
|
--- startpar.c
|
||||||
+++ startpar.c 2011-03-11 15:59:16.000000000 +0000
|
+++ startpar.c 2011-04-20 11:13:07.375925983 +0000
|
||||||
@@ -52,6 +52,12 @@
|
@@ -52,6 +52,12 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -183,7 +183,7 @@
|
|||||||
sigprocmask(SIG_UNBLOCK, &nmask, NULL);
|
sigprocmask(SIG_UNBLOCK, &nmask, NULL);
|
||||||
|
|
||||||
(void)signal(SIGINT, SIG_DFL);
|
(void)signal(SIGINT, SIG_DFL);
|
||||||
@@ -473,6 +467,7 @@ void run(struct prg *p)
|
@@ -473,12 +467,14 @@ void run(struct prg *p)
|
||||||
(void)signal(SIGTERM, SIG_DFL);
|
(void)signal(SIGTERM, SIG_DFL);
|
||||||
(void)signal(SIGCHLD, SIG_DFL);
|
(void)signal(SIGCHLD, SIG_DFL);
|
||||||
(void)signal(SIGTTIN, SIG_DFL);
|
(void)signal(SIGTTIN, SIG_DFL);
|
||||||
@ -191,16 +191,28 @@
|
|||||||
|
|
||||||
if (setpgid(0, 0))
|
if (setpgid(0, 0))
|
||||||
perror("setpgid");
|
perror("setpgid");
|
||||||
@@ -486,7 +481,7 @@ void run(struct prg *p)
|
|
||||||
|
if (m && p->fd)
|
||||||
|
{
|
||||||
|
+ sigset_t smask, omask;
|
||||||
|
TEMP_FAILURE_RETRY(close(1));
|
||||||
|
if (open(m, O_RDWR) != 1)
|
||||||
|
{
|
||||||
|
@@ -486,8 +482,12 @@ void run(struct prg *p)
|
||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
TEMP_FAILURE_RETRY(dup2(1, 2));
|
TEMP_FAILURE_RETRY(dup2(1, 2));
|
||||||
- if (tcsetattr(1, TCSANOW, &tio))
|
- if (tcsetattr(1, TCSANOW, &tio))
|
||||||
|
+ sigemptyset(&smask);
|
||||||
|
+ sigaddset(&smask, SIGTTOU);
|
||||||
|
+ sigprocmask(SIG_BLOCK, &smask, &omask);
|
||||||
+ if (tcsetattr(1, TCSANOW, &tio) && errno != ENOTTY)
|
+ if (tcsetattr(1, TCSANOW, &tio) && errno != ENOTTY)
|
||||||
perror("tcsetattr");
|
perror("tcsetattr");
|
||||||
|
+ sigprocmask(SIG_SETMASK, &omask, NULL);
|
||||||
if (wzok)
|
if (wzok)
|
||||||
ioctl(1, TIOCSWINSZ, &wz);
|
ioctl(1, TIOCSWINSZ, &wz);
|
||||||
@@ -582,14 +577,7 @@ int run_single(const char *prg, const ch
|
putenv(sz.env_row);
|
||||||
|
@@ -582,14 +582,7 @@ int run_single(const char *prg, const ch
|
||||||
{
|
{
|
||||||
sigset_t nmask;
|
sigset_t nmask;
|
||||||
|
|
||||||
@ -216,7 +228,7 @@
|
|||||||
sigprocmask(SIG_UNBLOCK, &nmask, NULL);
|
sigprocmask(SIG_UNBLOCK, &nmask, NULL);
|
||||||
|
|
||||||
(void)signal(SIGINT, SIG_DFL);
|
(void)signal(SIGINT, SIG_DFL);
|
||||||
@@ -599,6 +587,7 @@ int run_single(const char *prg, const ch
|
@@ -599,6 +592,7 @@ int run_single(const char *prg, const ch
|
||||||
(void)signal(SIGTERM, SIG_DFL);
|
(void)signal(SIGTERM, SIG_DFL);
|
||||||
(void)signal(SIGCHLD, SIG_DFL);
|
(void)signal(SIGCHLD, SIG_DFL);
|
||||||
(void)signal(SIGTTIN, SIG_DFL);
|
(void)signal(SIGTTIN, SIG_DFL);
|
||||||
@ -224,7 +236,7 @@
|
|||||||
|
|
||||||
TEMP_FAILURE_RETRY(dup2(2, 1));
|
TEMP_FAILURE_RETRY(dup2(2, 1));
|
||||||
closeall();
|
closeall();
|
||||||
@@ -632,19 +621,20 @@ void do_forward(void)
|
@@ -632,19 +626,20 @@ void do_forward(void)
|
||||||
{
|
{
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
@ -247,7 +259,7 @@
|
|||||||
rr = r;
|
rr = r;
|
||||||
}
|
}
|
||||||
r -= rr;
|
r -= rr;
|
||||||
@@ -730,9 +720,23 @@ void detach(struct prg *p, const int sto
|
@@ -730,9 +725,23 @@ void detach(struct prg *p, const int sto
|
||||||
{
|
{
|
||||||
if ((pid = fork()) == 0)
|
if ((pid = fork()) == 0)
|
||||||
{
|
{
|
||||||
@ -271,7 +283,7 @@
|
|||||||
execlp(myname, myname, "-f", "--", p->name, NULL);
|
execlp(myname, myname, "-f", "--", p->name, NULL);
|
||||||
do_forward();
|
do_forward();
|
||||||
}
|
}
|
||||||
@@ -833,6 +837,8 @@ int main(int argc, char **argv)
|
@@ -833,6 +842,8 @@ int main(int argc, char **argv)
|
||||||
char *splashopt = 0;
|
char *splashopt = 0;
|
||||||
sigset_t nmask, omask, smask;
|
sigset_t nmask, omask, smask;
|
||||||
|
|
||||||
@ -280,7 +292,7 @@
|
|||||||
(void)sigemptyset(&nmask);
|
(void)sigemptyset(&nmask);
|
||||||
(void)sigaddset(&nmask, SIGHUP);
|
(void)sigaddset(&nmask, SIGHUP);
|
||||||
sigprocmask(SIG_UNBLOCK, &nmask, NULL);
|
sigprocmask(SIG_UNBLOCK, &nmask, NULL);
|
||||||
@@ -1015,7 +1021,8 @@ int main(int argc, char **argv)
|
@@ -1015,10 +1026,15 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
if (tcgetattr(0, &tio))
|
if (tcgetattr(0, &tio))
|
||||||
{
|
{
|
||||||
@ -290,3 +302,10 @@
|
|||||||
tcgetattr(2, &tio);
|
tcgetattr(2, &tio);
|
||||||
}
|
}
|
||||||
cfmakeraw(&tio);
|
cfmakeraw(&tio);
|
||||||
|
+ tio.c_lflag &= ~ECHO;
|
||||||
|
+ tio.c_lflag |= ISIG;
|
||||||
|
+ tio.c_cc[VTIME] = 0;
|
||||||
|
+ tio.c_cc[VMIN] = CMIN;
|
||||||
|
|
||||||
|
if (ioctl(0, TIOCGWINSZ, &wz) == 0)
|
||||||
|
wzok = 1;
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
------------------------------------------------------------------
|
||||||
|
Wed Apr 20 13:14:43 CEST 2011 - werner@suse.de
|
||||||
|
|
||||||
|
- Aoid possible trouble due raw pts/ptmx terminal line in both
|
||||||
|
blogd and startpar
|
||||||
|
- Block SIGTTOU during tcsetattr(3) library call in both blogd
|
||||||
|
and startpar
|
||||||
|
- Replace select(2) with pselect(2) in blogd and ensure that
|
||||||
|
the timeout structure will be reseted after a timeout
|
||||||
|
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
Tue Apr 19 15:51:23 CEST 2011 - werner@suse.de
|
Tue Apr 19 15:51:23 CEST 2011 - werner@suse.de
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user