summaryrefslogtreecommitdiff
path: root/recipes-core
diff options
context:
space:
mode:
authorJeff Hatch <jhatch@multitech.com>2022-02-09 15:51:43 -0600
committerJeff Hatch <jhatch@multitech.com>2022-02-09 15:51:43 -0600
commit82f2c8cb89196dd4376278581f00d85fd71945f3 (patch)
tree7904767d0bc195c47d9263dba70b89289dec87ee /recipes-core
parente013cebe7b874d970b5b609ec3e5d236a9a1d1c0 (diff)
parentf60c9ff1f9f1f161d9aba021827792d0df3d2ba7 (diff)
downloadmeta-mlinux-82f2c8cb89196dd4376278581f00d85fd71945f3.tar.gz
meta-mlinux-82f2c8cb89196dd4376278581f00d85fd71945f3.tar.bz2
meta-mlinux-82f2c8cb89196dd4376278581f00d85fd71945f3.zip
Merge branch 'ss/mtcap3/bootlogd-fix' into mpower-dev-nxp
Diffstat (limited to 'recipes-core')
-rw-r--r--recipes-core/sysvinit/sysvinit/bootlogd-support-more-console-names.patch66
-rw-r--r--recipes-core/sysvinit/sysvinit_2.96.bbappend10
2 files changed, 76 insertions, 0 deletions
diff --git a/recipes-core/sysvinit/sysvinit/bootlogd-support-more-console-names.patch b/recipes-core/sysvinit/sysvinit/bootlogd-support-more-console-names.patch
new file mode 100644
index 0000000..2286750
--- /dev/null
+++ b/recipes-core/sysvinit/sysvinit/bootlogd-support-more-console-names.patch
@@ -0,0 +1,66 @@
+From 8a085ea9b7f2d8e59cbf17e9c04b155fddab4dd9 Mon Sep 17 00:00:00 2001
+From: Jesse Smith <jsmith@resonatingmedia.com>
+Date: Tue, 3 Aug 2021 18:21:16 -0300
+Subject: Applied patch from Matthias Schiffer which allows bootlogd to read
+ from a wider range of consoles. The console name is already passed in from
+ the kernel command line using "console=". We no longer filter out names as
+ strictly but do now check to confirm the "console=" device points to a valid
+ TTY.
+
+---
+ src/bootlogd.c | 25 ++++++++++++++++++++++++-
+ 1 file changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/src/bootlogd.c b/src/bootlogd.c
+index 787db87..78e4c81 100644
+--- a/src/bootlogd.c
++++ b/src/bootlogd.c
+@@ -212,6 +212,22 @@ int findpty(int *master, int *slave, char *name)
+
+ return 0;
+ }
++
++static int istty(const char *dev)
++{
++ int fd, ret;
++
++ fd = open(dev, O_RDONLY|O_NONBLOCK);
++ if (fd < 0)
++ return 0;
++
++ ret = isatty(fd);
++
++ close(fd);
++
++ return ret;
++}
++
+ /*
+ * See if a console taken from the kernel command line maps
+ * to a character device we know about, and if we can open it.
+@@ -228,7 +244,7 @@ int isconsole(char *s, char *res, int rlen)
+ l = strlen(c->cmdline);
+ if (sl <= l) continue;
+ p = s + l;
+- if (strncmp(s, c->cmdline, l) != 0 || !isdigit(*p))
++ if (strncmp(s, c->cmdline, l) != 0)
+ continue;
+ for (i = 0; i < 2; i++) {
+ snprintf(res, rlen, i ? c->dev1 : c->dev2, p);
+@@ -239,6 +255,13 @@ int isconsole(char *s, char *res, int rlen)
+ }
+ }
+ }
++
++ /* Fallback: accept any TTY device */
++ snprintf(res, rlen, "/dev/%s", s);
++ if ((q = strchr(res, ',')) != NULL) *q = 0;
++ if (istty(res))
++ return 1;
++
+ return 0;
+ }
+
+--
+cgit v1.1
+
diff --git a/recipes-core/sysvinit/sysvinit_2.96.bbappend b/recipes-core/sysvinit/sysvinit_2.96.bbappend
new file mode 100644
index 0000000..1f30887
--- /dev/null
+++ b/recipes-core/sysvinit/sysvinit_2.96.bbappend
@@ -0,0 +1,10 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+# Backport from sysvinit 3.00. Remove bbappend when updating the main recipe to
+# 3.00 or newer.
+
+PR = "r0"
+
+SRC_URI_append = " \
+ file://bootlogd-support-more-console-names.patch \
+"