--- libconsole.c +++ libconsole.c 2010-11-09 15:24:33.895925637 +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; } @@ -1347,7 +1348,7 @@ void secondtty(struct console *restrict 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