From patchwork Sat Jan 13 20:46:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosen Penev X-Patchwork-Id: 860373 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="lhJUwOdW"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="AHm0Pf9u"; 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 3zJs904YZCz9sNV for ; Sun, 14 Jan 2018 07:46:28 +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=kyBZsoLNTSDqT7WVIs18zcYIfiX6kvJe/Nvhaqyqi/w=; b=lhJUwOdWYA9ZKh 99WRyjYMuKOxBjnb8tPmYSZJZI+hiOkP6tGwe2GcPZIBC6byIJFMdfGAMAEmWm9X6zHNZZwTikfTq POJXzEOI4LuWH7mSGKYKiwVRYN2Xd2D17uiC0IGBRv4HPP2Avut7VW4H0WnkP123ZDIEPP2dXQ5sv 5qwSJK8nKH2LuawKCdjZqX8lq9+1BsGbRHkqcZNDGyAnzsaQUPJcfJmGB5NZHaAHB50zyfJJVJegN UgcZyQ9jcJTp1XX9uVRqr6mNAYBb+sRS4o2YYNvts4XjyH4+PuEUYl9dZic7AKM+2505huhnr9qgT dkZnBnpMepi2eDC7sx2w==; 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 1eaSh7-0008Je-UQ; Sat, 13 Jan 2018 20:46:25 +0000 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eaSh4-0008I3-OG for lede-dev@lists.infradead.org; Sat, 13 Jan 2018 20:46:24 +0000 Received: by mail-pg0-x243.google.com with SMTP id f14so6355455pga.10 for ; Sat, 13 Jan 2018 12:46:12 -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=oUm0DzHTuBL8aRB8PFpS9AuqnNgStgxtcgN6mLQAjYE=; b=AHm0Pf9uO/zavRk7ul+F17M07jjrfxRsfZGPV8Stg/A5kITU4oNUNhkAuyRzCEX1XV dx10gzVdRPh+Dlrrwv2RB6RtdIOF6gZJW1o+HlEBPp0UgHWewNP4Wcfdta7Xwx78GFCq FcpZtEqAr/WjQvl3Uo++aHJks32GyLwhvObcEL4yrUwthdI57iVkg0bMoS5S5l9QgRoB 8Ek+y+7+0DsuDFDn3RPeNQJ8IC9OHisKSIDeQ5O4wkiouc5RchCbnaw3APAlItqfPoL/ baQNbxBwZEDcbh76EFE/amXPvobdLTV+gne1wIQGo6yCtBm+7A6wyJ3xH70nbgjBwYvG ldvw== 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=oUm0DzHTuBL8aRB8PFpS9AuqnNgStgxtcgN6mLQAjYE=; b=BVWaQpmsuVxK92tFO5HgkYSBuRhvxv1mPNWC4NgH3zzT7G2IEI9Eh4mxmxP57AdwQi bHvvuja6uLkLAUd4ZGbF3c1V2ms8BwyVGqnDj9NPTWvi0O9UobATyZScuMpo2nVeHTYR wbT12a4HOxM5KHcmOVLuwmuhc5NJEX7On5WJLR2nO+nkWbToOHgFLwcIGB9E62XikJuw owk9Ruu92E3ab/MZKCrXzUhuMzRAIoaKo9xr6kte+cPX+EwHCh+ywVvlCSeeqn8+L70k 4t6htbDAPYxsLdJh7PVyyao29U0raRxk6xyPyFYuj+LOgt+bAQ/WZR6IDGR3WG+knEFO A4bg== X-Gm-Message-State: AKGB3mLUHbBwj7rUJ1jHYm5z9GcPXOnwwAJy9xGROYxkI80BCQb1e0Lw fJVRIOfyy9f9vTkD/GmZHUYMQFMY X-Google-Smtp-Source: ACJfBossMcegccuISUVpEN5D9bP67h6OFqknFw5MSJxXgkPO9mGUSBU4ggMNz7jF2y59PPdSRDJcNA== X-Received: by 10.99.110.71 with SMTP id j68mr23419862pgc.54.1515876371156; Sat, 13 Jan 2018 12:46:11 -0800 (PST) Received: from DESKTOP-CEH0M93.lan ([2001:470:1f05:c3e:a8fd:436e:b8ec:3aea]) by smtp.gmail.com with ESMTPSA id n7sm14791243pgv.26.2018.01.13.12.46.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 13 Jan 2018 12:46:10 -0800 (PST) From: Rosen Penev To: lede-dev@lists.infradead.org Date: Sat, 13 Jan 2018 12:46:04 -0800 Message-Id: <1515876364-44-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-20180113_124622_819439_F33AFD39 X-CRM114-Status: UNSURE ( 8.53 ) 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:c05:0:0:0:243 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] ubox: Replace strerror(errno) with %m format. 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 872 bytes on Ubuntu 16.04. No change in functionality. Signed-off-by: Rosen Penev --- getrandom.c | 4 ++-- log/logd.c | 2 +- log/logread.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/getrandom.c b/getrandom.c index 73a37b0..ad3a7af 100644 --- a/getrandom.c +++ b/getrandom.c @@ -50,9 +50,9 @@ int main(int argc, char *argv[]) if (nbtot <= sizeof(buf)) len = nbtot; if (syscall(SYS_getrandom, buf, len, 0) == -1) - ERROR_EXIT("getrandom() failed: %s\n", strerror(errno)); + ERROR_EXIT("getrandom() failed: %m\n"); if (write(STDOUT_FILENO, buf, len) != len) - ERROR_EXIT("write() failed: %s\n", strerror(errno)); + ERROR_EXIT("write() failed: %m\n"); nbtot -= sizeof(buf); } diff --git a/log/logd.c b/log/logd.c index 9931723..18788fe 100644 --- a/log/logd.c +++ b/log/logd.c @@ -119,7 +119,7 @@ read_log(struct ubus_context *ctx, struct ubus_object *obj, l = log_list(count, NULL); if (stream) { if (pipe(fds) == -1) { - fprintf(stderr, "logd: failed to create pipe: %s\n", strerror(errno)); + fprintf(stderr, "logd: failed to create pipe: %m\n"); return -1; } diff --git a/log/logread.c b/log/logread.c index 784d1f9..d85e03c 100644 --- a/log/logread.c +++ b/log/logread.c @@ -78,7 +78,7 @@ static void log_handle_reconnect(struct uloop_timeout *timeout) { sender.fd = usock((log_udp) ? (USOCK_UDP) : (USOCK_TCP), log_ip, log_port); if (sender.fd < 0) { - fprintf(stderr, "failed to connect: %s\n", strerror(errno)); + fprintf(stderr, "failed to connect: %m\n"); uloop_timeout_set(&retry, 1000); } else { uloop_fd_add(&sender, ULOOP_READ); @@ -126,7 +126,7 @@ static int log_notify(struct blob_attr *msg) } sender.fd = open(log_file, O_CREAT | O_WRONLY | O_APPEND, 0600); if (sender.fd < 0) { - fprintf(stderr, "failed to open %s: %s\n", log_file, strerror(errno)); + fprintf(stderr, "failed to open %s: %m\n", log_file); exit(-1); } } @@ -358,7 +358,7 @@ int main(int argc, char **argv) log_type = LOG_FILE; sender.fd = open(log_file, O_CREAT | O_WRONLY| O_APPEND, 0600); if (sender.fd < 0) { - fprintf(stderr, "failed to open %s: %s\n", log_file, strerror(errno)); + fprintf(stderr, "failed to open %s: %m\n", log_file); exit(-1); } } else {