diff --git a/doc/Changelog b/doc/Changelog index 1758dd7..191147d 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -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 Sun Apr 11 11:28:55 CEST 2010 diff --git a/src/bootlogd.c b/src/bootlogd.c index 34d05c2..4f820a8 100644 --- a/src/bootlogd.c +++ b/src/bootlogd.c @@ -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;