From patchwork Mon Dec 25 22:55:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 852885 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="foPP/XuN"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nqTm9btB"; 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 3z5Dxf2bvKz9ryv for ; Tue, 26 Dec 2017 09:56:22 +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:Message-Id: Date:To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=JFXPqwC0bxytHazEaFmKJ30cmgqCqjtA2gZ8VHHWrFE=; b=foPP/XuNx/oDqz 5ozz/eaHOI9ZadsjQRftI+7OlOdcEQ24WvMGwNxmVEiogHD3v4op8qEWlkwA6BNRKsWTfSePewUZA xV2Kbxuy7v29wYzveD4nGBU2HgCct3bD66WbE0Gyj6bIemeE3nRc+uo4kVDJs1isUaONakCUFKqnC 5KP6Qw7Y2lBd4fg3JLbzKSs/zJ2Z7utUo/qFfA5MVbUFf58czDMrmakg8urdS0QaBnRo8Bl+GqwEo TlkboxfGRIMSnj6meHNzfJciWb9Cls0y8GO+76UuJa71fo1500twXM2QvAg53uO41DydJjn01hWzL HMMQ/CHnhpghfKzK3yYw==; 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 1eTbfH-0007uV-Jd; Mon, 25 Dec 2017 22:56:11 +0000 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eTbf1-0007cF-Mw for lede-dev@lists.infradead.org; Mon, 25 Dec 2017 22:56:07 +0000 Received: by mail-pl0-x244.google.com with SMTP id d21so17059396pll.1 for ; Mon, 25 Dec 2017 14:55:45 -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; bh=zkDPki9YPxk/wDaq3EnoKL5ZCCYAHb4b58eNupv+fL0=; b=nqTm9btBC53CP549RmmFIbU+DPZQYDypC1GT/mlmWzCxq/QQuKipk9KKGCMziStSLN z+mzQA29/yMrTK+AWW+3ArU5d21e4ZnRVQiMhY+9TYZQ5TUTjFc900PafXPD9C49ORbW Q+erD6avX99d8UVNhB1uEalcnuBIE8SD9DxennTfkVM6ZkNpwmBG7nucVS3A+pkB5ghO BUXktKLznpGtTpvs/T+qw6r4L4mh8+luArC+JC7Q/wHSMptKoePtQmaQrxADFxTnyN3j +FFHhCLYNJ8kz9h1FbCUmMy9vtoCzrRDsSGpdMXc7VaJUhEMXNDHpVG60rz2A/LzXzJn wkCg== 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; bh=zkDPki9YPxk/wDaq3EnoKL5ZCCYAHb4b58eNupv+fL0=; b=GOb/RTMLTjGrXrtClXng30Tc4SMLgkbJvtIMYvgDeWXCWvfXPlE3XOyrQ9Ed3f+x+y 2nJ0J96nzYYf4IS+JPexjaKfn83FjRHpFY13PkDUyoKSVkKhkve6V9qR/O1ncVi6yiG1 gcI1NXputG9Ieh2f9kAH7L8DjcbsoIXfjypPbjmhlPOEOY2NEayAQfYQwnVHsNP45KQ5 Mu/nfZuSMWgZF0DnGNdadEL7gqUg5ediSEKDO1dboosrF0OQGNitnRGJB/1U4038wvU0 HKsXwwxz//jFjPjpOaOUjosNgot2+UWaFngyxRagW/o61JdS3jKfieLn9+DRSYE1hSyd +z/w== X-Gm-Message-State: AKGB3mKCTEimiyHFIt8WGG7/iJh/P8DjSrEcBpRJx2GDEq6G1Fl19G3M hV+hmUG0MfWlbwrTsDAtkQ7KWI2o X-Google-Smtp-Source: ACJfBovgMHkLQRnKyKdR+MJCFSn/tP7Jh+DBl+ds89kVPaJcDwySDH/nUopkJX7l4enu4MxwA4Vkbw== X-Received: by 10.84.172.195 with SMTP id n61mr23017116plb.321.1514242544750; Mon, 25 Dec 2017 14:55:44 -0800 (PST) Received: from DESKTOP-CEH0M93.lan ([2001:470:1f05:c3e:98da:65ff:24e5:ee50]) by smtp.gmail.com with ESMTPSA id x4sm56985451pfk.51.2017.12.25.14.55.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Dec 2017 14:55:44 -0800 (PST) From: Rosen Penev To: lede-dev@lists.infradead.org Date: Mon, 25 Dec 2017 14:55:51 -0800 Message-Id: <1514242551-4382-1-git-send-email-rosenp@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171225_145556_630802_DFD8AC27 X-CRM114-Status: UNSURE ( 8.80 ) 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:244 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] luci: treewide: Replace strerror(errno) with %m. 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 Saves a few bytes. No functional difference. Signed-off-by: Rosen Penev --- contrib/package/freifunk-watchdog/src/watchdog.c | 6 ++--- contrib/package/freifunk-watchdog/src/watchdog.h | 6 ++--- modules/luci-mod-admin-full/src/luci-bwc.c | 31 ++++++++++++------------ 3 files changed, 19 insertions(+), 24 deletions(-) diff --git a/contrib/package/freifunk-watchdog/src/watchdog.c b/contrib/package/freifunk-watchdog/src/watchdog.c index f546985..3e46668 100644 --- a/contrib/package/freifunk-watchdog/src/watchdog.c +++ b/contrib/package/freifunk-watchdog/src/watchdog.c @@ -153,8 +153,7 @@ static int find_process(const char *name) return pid; } - syslog(LOG_CRIT, "Unable to open /proc: %s", - strerror(errno)); + syslog(LOG_CRIT, "Unable to open /proc: %m"); return -1; } @@ -381,8 +380,7 @@ static int do_daemon(void) if( (iwfd = socket(AF_INET, SOCK_DGRAM, 0)) == -1 ) { - syslog(LOG_ERR, "Can not open wireless control socket: %s", - strerror(errno)); + syslog(LOG_ERR, "Can not open wireless control socket: %m"); return 1; } diff --git a/contrib/package/freifunk-watchdog/src/watchdog.h b/contrib/package/freifunk-watchdog/src/watchdog.h index 6f2382d..d13bbd9 100644 --- a/contrib/package/freifunk-watchdog/src/watchdog.h +++ b/contrib/package/freifunk-watchdog/src/watchdog.h @@ -128,14 +128,12 @@ iw_ioctl(int skfd, /* Socket to the kernel */ switch(fork()) \ { \ case -1: \ - syslog(LOG_CRIT, "Unable to fork child: %s", \ - strerror(errno)); \ + syslog(LOG_CRIT, "Unable to fork child: %m"); \ break; \ \ case 0: \ execl(x, NULL); \ - syslog(LOG_CRIT, "Unable to execute action: %s", \ - strerror(errno)); \ + syslog(LOG_CRIT, "Unable to execute action: %m"); \ return 1; \ } \ } while(0) diff --git a/modules/luci-mod-admin-full/src/luci-bwc.c b/modules/luci-mod-admin-full/src/luci-bwc.c index 8ddd917..2d1cc6d 100644 --- a/modules/luci-mod-admin-full/src/luci-bwc.c +++ b/modules/luci-mod-admin-full/src/luci-bwc.c @@ -309,8 +309,8 @@ static int update_ifstat( { if (init_file(path, sizeof(struct traffic_entry))) { - fprintf(stderr, "Failed to init %s: %s\n", - path, strerror(errno)); + fprintf(stderr, "Failed to init %s: %m\n", + path); return -1; } @@ -339,8 +339,8 @@ static int update_radiostat( { if (init_file(path, sizeof(struct radio_entry))) { - fprintf(stderr, "Failed to init %s: %s\n", - path, strerror(errno)); + fprintf(stderr, "Failed to init %s: %m\n", + path); return -1; } @@ -367,8 +367,8 @@ static int update_cnstat(uint32_t udp, uint32_t tcp, uint32_t other) { if (init_file(path, sizeof(struct conn_entry))) { - fprintf(stderr, "Failed to init %s: %s\n", - path, strerror(errno)); + fprintf(stderr, "Failed to init %s: %m\n", + path); return -1; } @@ -395,8 +395,8 @@ static int update_ldstat(uint16_t load1, uint16_t load5, uint16_t load15) { if (init_file(path, sizeof(struct load_entry))) { - fprintf(stderr, "Failed to init %s: %s\n", - path, strerror(errno)); + fprintf(stderr, "Failed to init %s: %m\n", + path); return -1; } @@ -459,7 +459,7 @@ static int run_daemon(void) /* write pid */ if (writepid()) { - fprintf(stderr, "Failed to write pid file: %s\n", strerror(errno)); + fprintf(stderr, "Failed to write pid file: %m\n"); return 1; } @@ -574,15 +574,14 @@ static void check_daemon(void) if (run_daemon()) { fprintf(stderr, - "Failed to ping daemon and unable to start it up: %s\n", - strerror(errno)); + "Failed to ping daemon and unable to start it up: %m\n"); exit(1); } } else if (kill(pid, SIGUSR1)) { - fprintf(stderr, "Failed to send signal: %s\n", strerror(errno)); + fprintf(stderr, "Failed to send signal: %m\n"); exit(2); } } @@ -599,7 +598,7 @@ static int run_dump_ifname(const char *ifname) if (mmap_file(path, sizeof(struct traffic_entry), &m)) { - fprintf(stderr, "Failed to open %s: %s\n", path, strerror(errno)); + fprintf(stderr, "Failed to open %s: %m\n", path); return 1; } @@ -635,7 +634,7 @@ static int run_dump_radio(const char *ifname) if (mmap_file(path, sizeof(struct radio_entry), &m)) { - fprintf(stderr, "Failed to open %s: %s\n", path, strerror(errno)); + fprintf(stderr, "Failed to open %s: %m\n", path); return 1; } @@ -669,7 +668,7 @@ static int run_dump_conns(void) if (mmap_file(path, sizeof(struct conn_entry), &m)) { - fprintf(stderr, "Failed to open %s: %s\n", path, strerror(errno)); + fprintf(stderr, "Failed to open %s: %m\n", path); return 1; } @@ -703,7 +702,7 @@ static int run_dump_load(void) if (mmap_file(path, sizeof(struct load_entry), &m)) { - fprintf(stderr, "Failed to open %s: %s\n", path, strerror(errno)); + fprintf(stderr, "Failed to open %s: %m\n", path); return 1; }