From patchwork Mon Dec 25 22:14:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 852879 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=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JywvSgMt"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mqwbwe+d"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 3z5D2g4y45z9ryv for ; Tue, 26 Dec 2017 09:15:36 +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=irPzch34BmAiSTB4BLIvtpxL6rqQfKybBzZkE6MVBSU=; b=JywvSgMtr71Y4P NXW6Q7/pFTuO+law0zbZq584dv4Zo80gS1Rq9+Z1VsIkHURlVbxbfkKJECHqNW+zS2tqJcA5IMaR3 MwYXEBVHCpLG+B758/u/vzkmELnpMucuEKVIdbsSRFFtI57ge1mFU1LqPsyfXWA8aCqNjPMA+XOct wbiWlqFX946A1RxLUnigAvCPyegjqZ6I1HVfMzIb8jyny0aM6osYm3t4gYxTJfLJzHOhy4UKMvTsr d6VR6NeqhPFfZ7QrCZeKzzY+Np+sxyQ2qv7niprmpwqYWJ4329LV8vgjzP72EzavqED+nIfRdD+s0 Z7nMdnjivjwoGLdmOcLw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eTb1i-0008DI-3h; Mon, 25 Dec 2017 22:15:18 +0000 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eTb1I-0008Bm-Tv for lede-dev@lists.infradead.org; Mon, 25 Dec 2017 22:14:54 +0000 Received: by mail-pl0-x241.google.com with SMTP id z5so17030373plo.10 for ; Mon, 25 Dec 2017 14:14:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oqw7gEImHrUZhBK8N6zxu2CxM5FyQcJ6LypV1YglUgg=; b=mqwbwe+d1I8zapxAMiLPH5rAZJuJnmf/wRrxXMay05I5UY4S99kjeO2PDea3iseglO RpufCrR13vxoB8EnuewQPpnamxpsAJpBYPJyJx61v+j1Nf70vLCguXrUexbWcwU3rNTt riw9Am1J5fF/KXVTjM1p+GUzF1x+Gm1ihrXvf0QbqT86WZ/9k2CAzbPeyfdk3HFgLlID 4NQI6lTP9Ggt6CyuVCojZjzescIMBQZzbpv62wuU2n8qcRITETc7Mx30vW5pEAo7sdsT SQKmJdOwqR3oIPjLsp76vpyxootzHfQre0CLx9yb+/F+8LIegUaIlBef4eZkvwarHa8+ XqEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oqw7gEImHrUZhBK8N6zxu2CxM5FyQcJ6LypV1YglUgg=; b=Iods5b/f8+cdqp1x93vuir1QHXQmLqx0uD/PCbg7+Tgo0F2a70FzKtfZWjMxynkdNn S3ufZ1O1GttJQBOHvraSMaIf6CpNHpcRQTPM5XvZYO7fKJAdR0lROlhDvkCCkjcmJyQT PIqsr4gIo0IuEkMRIkRYFjNJ2EeoPbyXUcS9qhysLYAaOixWxheyz7w6tMPnp4JZWrSV MkmWuUt6Y4opKznNAY5MOyLaXKpEYWJOBk7C/ZG6xF15v+NiY+8EAcAV0Zel9zUfc2Qk Y/SMgVjEZpol6EEGpSxQk/8SsvR4qCLhBOjIpnQCiAlO3nH1NVwTWlkTBUl9HtB7puyg U2hg== X-Gm-Message-State: AKGB3mKt6ejAbz6CSKIp4E9J4DJk/IJNmH0Ws3rGMt5HdK24btMwEbmV 2ENl3ti7Bn6fcKsbmvyKF8Un0Xfz X-Google-Smtp-Source: ACJfBove8VVSxM45cOryJ/3yG79dXBEm0S35c79hAvOtFPgtrEKBEh41N5S6HqC1O9wBp0dNp5xD6g== X-Received: by 10.159.197.65 with SMTP id d1mr23352448plo.58.1514240081938; Mon, 25 Dec 2017 14:14:41 -0800 (PST) Received: from DESKTOP-CEH0M93.lan ([2001:470:1f05:c3e:98da:65ff:24e5:ee50]) by smtp.gmail.com with ESMTPSA id e8sm62309775pfk.6.2017.12.25.14.14.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Dec 2017 14:14:41 -0800 (PST) From: Rosen Penev To: lede-dev@lists.infradead.org Date: Mon, 25 Dec 2017 14:14:45 -0800 Message-Id: <1514240086-3654-2-git-send-email-rosenp@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1514240086-3654-1-git-send-email-rosenp@gmail.com> References: <1514240086-3654-1-git-send-email-rosenp@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171225_141452_990714_B44DB538 X-CRM114-Status: UNSURE ( 9.14 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c01:0:0:0:241 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (rosenp[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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: [LEDE-DEV] [PATCH 2/3] procd: Remove redundant errno variable in several printf functions. X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rosen Penev MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org %m, aka strerror(errno) is already used. No need to repeat it. Saves 280 bytes. Signed-off-by: Rosen Penev --- service/instance.c | 24 ++++++++++++------------ utils/utils.c | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/service/instance.c b/service/instance.c index 25735ab..7447bad 100644 --- a/service/instance.c +++ b/service/instance.c @@ -241,8 +241,8 @@ instance_removepid(struct service_instance *in) { if (!in->pidfile) return 0; if (unlink(in->pidfile)) { - ERROR("Failed to removed pidfile: %s: %d - %m\n", - in->pidfile, errno); + ERROR("Failed to removed pidfile: %s: %m\n", + in->pidfile); return 1; } return 0; @@ -258,19 +258,19 @@ instance_writepid(struct service_instance *in) } _pidfile = fopen(in->pidfile, "w"); if (_pidfile == NULL) { - ERROR("failed to open pidfile for writing: %s: %d (%m)", - in->pidfile, errno); + ERROR("failed to open pidfile for writing: %s: %m", + in->pidfile); return 1; } if (fprintf(_pidfile, "%d\n", in->proc.pid) < 0) { - ERROR("failed to write pidfile: %s: %d (%m)", - in->pidfile, errno); + ERROR("failed to write pidfile: %s: %m", + in->pidfile); fclose(_pidfile); return 2; } if (fclose(_pidfile)) { - ERROR("failed to close pidfile: %s: %d (%m)", - in->pidfile, errno); + ERROR("failed to close pidfile: %s: %m", + in->pidfile); return 3; } @@ -353,11 +353,11 @@ instance_run(struct service_instance *in, int _stdout, int _stderr) } if (in->gid && setgid(in->gid)) { - ERROR("failed to set group id %d: %d (%m)\n", in->gid, errno); + ERROR("failed to set group id %d: %m\n", in->gid); exit(127); } if (in->uid && setuid(in->uid)) { - ERROR("failed to set user id %d: %d (%m)\n", in->uid, errno); + ERROR("failed to set user id %d: %m\n", in->uid); exit(127); } @@ -407,14 +407,14 @@ instance_start(struct service_instance *in) instance_free_stdio(in); if (in->_stdout.fd.fd > -2) { if (pipe(opipe)) { - ULOG_WARN("pipe() failed: %d (%m)\n", errno); + ULOG_WARN("pipe() failed: %m\n"); opipe[0] = opipe[1] = -1; } } if (in->_stderr.fd.fd > -2) { if (pipe(epipe)) { - ULOG_WARN("pipe() failed: %d (%m)\n", errno); + ULOG_WARN("pipe() failed: %m\n"); epipe[0] = epipe[1] = -1; } } diff --git a/utils/utils.c b/utils/utils.c index 57c82eb..c5b9513 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -203,8 +203,8 @@ int patch_stdio(const char *device) for (fd = STDIN_FILENO; fd <= STDERR_FILENO; fd++) { if (patch_fd(device, fd, fd ? O_WRONLY : O_RDONLY)) { - ERROR("Failed to redirect %s to %s: %d (%m)\n", - fdname[fd], device, errno); + ERROR("Failed to redirect %s to %s: %m\n", + fdname[fd], device); rv = -1; } }