From patchwork Tue May 17 15:00:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jo-Philipp Wich X-Patchwork-Id: 623147 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3r8LFS42Wdz9s9Z for ; Wed, 18 May 2016 01:03:56 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b2gVq-00035l-3T; Tue, 17 May 2016 15:02:22 +0000 Received: from mxout01.bytecamp.net ([212.204.60.217]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b2gVn-0002zk-Uw for lede-dev@lists.infradead.org; Tue, 17 May 2016 15:02:20 +0000 Received: by mxout01.bytecamp.net (Postfix, from userid 1001) id 29C8E30FE42; Tue, 17 May 2016 17:01:09 +0200 (CEST) Received: from mail.bytecamp.net (mailstore.bytecamp.net [212.204.60.20]) by mxout01.bytecamp.net (Postfix) with ESMTP id A548530FE72 for ; Tue, 17 May 2016 17:01:08 +0200 (CEST) Received: (qmail 36625 invoked by uid 89); 17 May 2016 17:01:07 +0200 Received: from unknown (HELO localhost.localdomain) (jo%wwsnet.net@213.61.250.148) by mail.bytecamp.net with AES128-SHA encrypted SMTP; 17 May 2016 17:01:07 +0200 From: Jo-Philipp Wich To: lede-dev@lists.infradead.org Date: Tue, 17 May 2016 17:00:45 +0200 Message-Id: <06c2d5a6d5145642ae28a4f3a5bd66ca8a590e13.1463496164.git.jo@mein.io> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160517_080220_191994_50C83E42 X-CRM114-Status: UNSURE ( 8.13 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [212.204.60.217 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCH 3/5] initd: use patch_stdio() for kmodloader stdio redirection X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jo-Philipp Wich , john@phrozen.org MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Signed-off-by: Jo-Philipp Wich --- initd/init.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/initd/init.c b/initd/init.c index 4d17563..e453cff 100644 --- a/initd/init.c +++ b/initd/init.c @@ -86,17 +86,9 @@ main(int argc, char **argv) if (!pid) { char *kmod[] = { "/sbin/kmodloader", "/etc/modules-boot.d/", NULL }; - if (debug < 3) { - int fd = open("/dev/null", O_RDWR); - - if (fd > -1) { - dup2(fd, STDIN_FILENO); - dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); - if (fd > STDERR_FILENO) - close(fd); - } - } + if (debug < 3) + patch_stdio("/dev/null"); + execvp(kmod[0], kmod); ERROR("Failed to start kmodloader\n"); exit(-1);