[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sysvinit-devel] [PATCH] bootlogd.c: don't keep writing to broken consol
From: |
Richard Tollerton |
Subject: |
[sysvinit-devel] [PATCH] bootlogd.c: don't keep writing to broken consoles |
Date: |
Mon, 24 Jul 2017 12:13:14 -0500 |
Writing to a nonexistent UART will always return EIO. The present code
will spin in that event trying to write the same console data over and
over. Stop doing that.
Signed-off-by: Richard Tollerton <address@hidden>
---
src/bootlogd.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/bootlogd.c b/src/bootlogd.c
index dce1631..4e70ff9 100644
--- a/src/bootlogd.c
+++ b/src/bootlogd.c
@@ -492,6 +492,7 @@ int main(int argc, char **argv)
#ifndef __linux__ /* BSD-style ioctl needs an argument. */
int on = 1;
#endif
+ int prev_eio = 0;
fp = NULL;
logfile = LOGFILE;
@@ -642,8 +643,15 @@ int main(int argc, char **argv)
if (i >= 0) {
m -= i;
p += i;
+ prev_eio = 0;
continue;
}
+ /* Don't try to write the same data
+ * again if we got EIO twice */
+ if (errno == EIO && prev_eio) {
+ m = 0;
+ }
+ prev_eio = (errno == EIO);
/*
* Handle EIO (somebody hung
* up our filedescriptor)
--
2.12.2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [sysvinit-devel] [PATCH] bootlogd.c: don't keep writing to broken consoles,
Richard Tollerton <=