Adapt bootlogd TIOCCONS call to kfreebsd. Patch from Mats Erik

Andersson and Debian.
This commit is contained in:
Petter Reinholdtsen 2014-02-07 17:03:04 +00:00
parent 3f08c42b06
commit 1b91c378b9
2 changed files with 12 additions and 2 deletions

View File

@ -75,6 +75,8 @@ sysvinit (2.89dsf) UNRELEASED; urgency=low
Patch from Matias A. Fonzo and Dragora.
* Rewrite findtty() in bootlogd.c to not chance working directory, to
reduce the amount of failure that can happin in that function.
* Adapt bootlogd TIOCCONS call to kfreebsd. Patch from Mats Erik
Andersson and Debian.
-- Petter Reinholdtsen <pere@hungry.com> Sun Apr 11 11:28:55 CEST 2010

View File

@ -488,6 +488,9 @@ int main(int argc, char **argv)
int realfd;
int n, m, i;
int todo;
#ifndef __linux__ /* BSD-style ioctl needs an argument. */
int on = 1;
#endif
fp = NULL;
logfile = LOGFILE;
@ -560,15 +563,20 @@ int main(int argc, char **argv)
return 1;
}
#ifdef __linux__
(void)ioctl(0, TIOCCONS, NULL);
#if 1
/* Work around bug in 2.1/2.2 kernels. Fixed in 2.2.13 and 2.3.18 */
if ((n = open("/dev/tty0", O_RDWR)) >= 0) {
(void)ioctl(n, TIOCCONS, NULL);
close(n);
}
#endif
if (ioctl(pts, TIOCCONS, NULL) < 0) {
#ifdef __linux__
if (ioctl(pts, TIOCCONS, NULL) < 0)
#else /* BSD usage of ioctl TIOCCONS. */
if (ioctl(pts, TIOCCONS, &on) < 0)
#endif
{
fprintf(stderr, "bootlogd: ioctl(%s, TIOCCONS): %s\n",
buf, strerror(errno));
return 1;