From patchwork Tue Jan 1 23:44:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Heimpold X-Patchwork-Id: 1019858 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=heimpold.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hwkblXpk"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=heimpold.de header.i=@heimpold.de header.b="RlC0+rEr"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43TrRN3CC7z9rxp for ; Wed, 2 Jan 2019 10:46:08 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zlBSBGfnXuJYYo2lo1Tcq9Zni3f5/Qo/gVMjy8IUHGM=; b=hwkblXpkqUFZ9Q n41RgMDxsZVTMpuLfVkktxS1QJ728HKBjDQh6WUhfAp08ad0pPzbSLpq4vVW4LVIWhAm71EXO10mB 9GEJElDulp2njv9LmkIAkhXXntkjtnzc3LO0AbJYla10cBAd2kjAFy/019glR8R2iOgIHXq8lsU3n eUyoDz45j8LxjTG9bZhcBjT3VW/zKrY/BlkR0Q/3GCEchNv3RmeeA86st0JbhzwOIOBb58dpR+8Mg nikYgkqm4BVc2iSrFVOcPn1pECBX4723Ga7LK+zs0EcGTS5TSoMGYmtCE4bd5pGIWkNV9QOFJ7Pno hD87KGxI9NMd5TkeGniw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTjY-00050T-Gw; Tue, 01 Jan 2019 23:46:04 +0000 Received: from mo6-p01-ob.smtp.rzone.de ([2a01:238:20a:202:5301::7]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1geTig-00033O-EO for openwrt-devel@lists.openwrt.org; Tue, 01 Jan 2019 23:45:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1546386303; s=strato-dkim-0002; d=heimpold.de; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=t3rTtFw3yB91MqIaWV5S8CrJr5SbgQFl1fOmOyqBDLQ=; b=RlC0+rEr7gwF08QlRX2JDw2jHuC8JwiAOORyyoZg4g0yw6WMNRxhXAFqd4JVaLPsPA Fgi/Eg/qtRGARjIwA4OS8McP5jMOvOzimL+xpo6hmgnZCMQNMp/BraQn7i1h7xwfWEeL SF1v/l3TgNFvoa+UJrXcwDLMyG6Aj5FCqgLqVXWIM/4pxTy606LEGNgvvoR+qaYCkKdt AIAxpodZY+DhZGiUUscC2jLoMJ/DuAQYGyGvtSHAp+8pQJuc0JGY9VzRPQB/OUgUbfrt zIebPOU3szMspsTJJtH4NO3cMfcUVtA/8a4y6zDV/1gHKkxKLAw4rYp+Y6nJ8dVuSrwk qGGA== X-RZG-AUTH: ":O2kGeEG7b/pS1EW8QnKjhhg/vO4pzqdNytq77N6ZKUSN7PfdWTGbO3oK8Gj1rLTl4HJ2UQ==" X-RZG-CLASS-ID: mo00 Received: from tonne.mhei.heimpold.itr by smtp.strato.de (RZmta 44.9 DYNA|AUTH) with ESMTPSA id y05b79v01Nj3HZs (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Wed, 2 Jan 2019 00:45:03 +0100 (CET) Received: from kerker.mhei.heimpold.itr (kerker.mhei.heimpold.itr [192.168.8.1]) by tonne.mhei.heimpold.itr (Postfix) with ESMTP id E2EF41C7AC1; Wed, 2 Jan 2019 00:45:02 +0100 (CET) From: Michael Heimpold To: openwrt-devel@lists.openwrt.org Date: Wed, 2 Jan 2019 00:44:59 +0100 Message-Id: <2ae55c8d3fb44a81f471c1ccc911ef21ddffb74a.1546385477.git.mhei@heimpold.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190101_154510_918757_6BE2F808 X-CRM114-Status: GOOD ( 11.02 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a01:238:20a:202:5301:0:0:7 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH 7/7] procd: replace exit(-1) with exit(EXIT_FAILURE) X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Heimpold MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Signed-off-by: Michael Heimpold --- initd/init.c | 2 +- initd/preinit.c | 6 +++--- initd/zram.c | 4 ++-- plug/coldplug.c | 3 ++- plug/hotplug.c | 14 +++++++------- upgraded/upgraded.c | 2 +- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/initd/init.c b/initd/init.c index 0349e6e..8d012f6 100644 --- a/initd/init.c +++ b/initd/init.c @@ -91,7 +91,7 @@ main(int argc, char **argv) execvp(kmod[0], kmod); ERROR("Failed to start kmodloader: %m\n"); - exit(-1); + exit(EXIT_FAILURE); } if (pid <= 0) { ERROR("Failed to start kmodloader instance: %m\n"); diff --git a/initd/preinit.c b/initd/preinit.c index fbb36df..0b0d291 100644 --- a/initd/preinit.c +++ b/initd/preinit.c @@ -23,7 +23,7 @@ #include #include - +#include #include #include "init.h" @@ -135,7 +135,7 @@ preinit(void) if (!plugd_proc.pid) { execvp(plug[0], plug); ERROR("Failed to start plugd: %m\n"); - exit(-1); + exit(EXIT_FAILURE); } if (plugd_proc.pid <= 0) { ERROR("Failed to start new plugd instance: %m\n"); @@ -157,7 +157,7 @@ preinit(void) if (!preinit_proc.pid) { execvp(init[0], init); ERROR("Failed to start preinit: %m\n"); - exit(-1); + exit(EXIT_FAILURE); } if (preinit_proc.pid <= 0) { ERROR("Failed to start new preinit instance: %m\n"); diff --git a/initd/zram.c b/initd/zram.c index b41bfd9..2f92b3f 100644 --- a/initd/zram.c +++ b/initd/zram.c @@ -65,7 +65,7 @@ early_insmod(char *module) modprobe[1] = path; execvp(modprobe[0], modprobe); ERROR("Can't exec %s: %m\n", modprobe[0]); - exit(-1); + exit(EXIT_FAILURE); } if (pid <= 0) { @@ -108,7 +108,7 @@ mount_zram_on_tmp(void) if (!pid) { execvp(mkfs[0], mkfs); ERROR("Can't exec %s: %m\n", mkfs[0]); - exit(-1); + exit(EXIT_FAILURE); } else if (pid <= 0) { ERROR("Can't exec %s: %m\n", mkfs[0]); return -1; diff --git a/plug/coldplug.c b/plug/coldplug.c index c6a89c3..e2d1074 100644 --- a/plug/coldplug.c +++ b/plug/coldplug.c @@ -16,6 +16,7 @@ #include #include +#include #include #include "../procd.h" @@ -55,7 +56,7 @@ void procd_coldplug(void) if (!udevtrigger.pid) { execvp(argv[0], argv); ERROR("Failed to start coldplug: %m\n"); - exit(-1); + exit(EXIT_FAILURE); } if (udevtrigger.pid <= 0) { diff --git a/plug/hotplug.c b/plug/hotplug.c index 6b5960a..ed61490 100644 --- a/plug/hotplug.c +++ b/plug/hotplug.c @@ -206,7 +206,7 @@ static void handle_exec(struct blob_attr *msg, struct blob_attr *data) argv[i] = NULL; execvp(argv[0], &argv[0]); } - exit(-1); + exit(EXIT_FAILURE); } static void handle_button_start(struct blob_attr *msg, struct blob_attr *data) @@ -231,7 +231,7 @@ static void handle_firmware(struct blob_attr *msg, struct blob_attr *data) if (!file || !dir || !dev) { ERROR("Request for unknown firmware %s/%s\n", dir, file); - exit(-1); + exit(EXIT_FAILURE); } path = alloca(strlen(dir) + strlen(file) + 2); @@ -256,11 +256,11 @@ send_to_kernel: load = open(loadpath, O_WRONLY); if (!load) { ERROR("Failed to open %s: %m\n", loadpath); - exit(-1); + exit(EXIT_FAILURE); } if (write(load, "1", 1) == -1) { ERROR("Failed to write to %s: %m\n", loadpath); - exit(-1); + exit(EXIT_FAILURE); } close(load); @@ -268,7 +268,7 @@ send_to_kernel: fw = open(syspath, O_WRONLY); if (fw < 0) { ERROR("Failed to open %s: %m\n", syspath); - exit(-1); + exit(EXIT_FAILURE); } len = s.st_size; @@ -294,7 +294,7 @@ send_to_kernel: DEBUG(2, "Done loading %s\n", path); - exit(-1); + exit(EXIT_FAILURE); } static void handle_start_console(struct blob_attr *msg, struct blob_attr *data) @@ -308,7 +308,7 @@ static void handle_start_console(struct blob_attr *msg, struct blob_attr *data) DEBUG(2, "Done starting console for %s\n", dev); - exit(-1); + exit(EXIT_FAILURE); } enum { diff --git a/upgraded/upgraded.c b/upgraded/upgraded.c index 0b82f20..db98701 100644 --- a/upgraded/upgraded.c +++ b/upgraded/upgraded.c @@ -56,7 +56,7 @@ static void sysupgrade(char *path, char *command) /* Child */ execvp(args[0], args); fprintf(stderr, "Failed to exec sysupgrade\n"); - _exit(-1); + _exit(EXIT_FAILURE); } uloop_process_add(&upgrade_proc);