summaryrefslogtreecommitdiff
path: root/package/system/procd/patches/0002-early-remove-superfluous-close-of-stdio-file-descrip.patch
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-07-19 17:12:44 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-07-19 17:12:44 +0000
commitadba04e53f934fda623c7c1ef180653c7d907b2b (patch)
tree376118dfe06ec98265383936bdbb4d8aba5937b2 /package/system/procd/patches/0002-early-remove-superfluous-close-of-stdio-file-descrip.patch
parent0f0f250b66aa35d1df69d6b3040c10b298e60e8e (diff)
downloadmtk-20170518-adba04e53f934fda623c7c1ef180653c7d907b2b.zip
mtk-20170518-adba04e53f934fda623c7c1ef180653c7d907b2b.tar.gz
mtk-20170518-adba04e53f934fda623c7c1ef180653c7d907b2b.tar.bz2
procd: improve early console handling
The malta target is broken since procd is used as init. The initramfs image boots fine, however the console is not working. Improve the early console handling to fix the problem. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 37451
Diffstat (limited to 'package/system/procd/patches/0002-early-remove-superfluous-close-of-stdio-file-descrip.patch')
-rw-r--r--package/system/procd/patches/0002-early-remove-superfluous-close-of-stdio-file-descrip.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/package/system/procd/patches/0002-early-remove-superfluous-close-of-stdio-file-descrip.patch b/package/system/procd/patches/0002-early-remove-superfluous-close-of-stdio-file-descrip.patch
new file mode 100644
index 0000000..0969832
--- /dev/null
+++ b/package/system/procd/patches/0002-early-remove-superfluous-close-of-stdio-file-descrip.patch
@@ -0,0 +1,40 @@
+From 1edd25cfa0a26dac1ca5d49bce479ebdea336437 Mon Sep 17 00:00:00 2001
+From: Gabor Juhos <juhosg@openwrt.org>
+Date: Fri, 19 Jul 2013 08:21:17 +0200
+Subject: [PATCH 2/2] early: remove superfluous close of stdio file
+ descriptors
+
+'man dup2' says:
+
+ dup2() makes newfd be the copy of oldfd, closing newfd first if
+ necessary, but note the following:
+
+ * If oldfd is not a valid file descriptor, then the call fails,
+ and newfd is not closed.
+
+ * If oldfd is a valid file descriptor, and newfd has the same
+ value as oldfd, then dup2() does nothing, and returns newfd.
+
+Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
+---
+ early.c | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/early.c b/early.c
+index 204623b..f9e3277 100644
+--- a/early.c
++++ b/early.c
+@@ -53,10 +53,6 @@ static void early_console(const char *dev)
+ mkdev("*console", 0600);
+
+ dd = open(dev, O_RDWR);
+- close(STDIN_FILENO);
+- close(STDOUT_FILENO);
+- close(STDERR_FILENO);
+-
+ if (dd < 0) {
+ ERROR("Failed to open %s\n", dev);
+ return;
+--
+1.7.10
+