From patchwork Sat Dec 3 17:58:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 702351 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 3tWJjy4tsZz9ryk for ; Sun, 4 Dec 2016 05:01:26 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="hef7Oi9J"; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cDEat-0006Hn-2x; Sat, 03 Dec 2016 17:59:27 +0000 Received: from mail-oi0-x241.google.com ([2607:f8b0:4003:c06::241]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cDEap-0006C9-Rn for lede-dev@lists.infradead.org; Sat, 03 Dec 2016 17:59:24 +0000 Received: by mail-oi0-x241.google.com with SMTP id f201so31551227oib.0 for ; Sat, 03 Dec 2016 09:59:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=K89B6aV1CkjPvRNvgMYHKVQus6duWMVAFBkGJinZogU=; b=hef7Oi9Jt4ovtQI7FQxhH6j/626kItb6vL6qxYHNKRMqroEMC+7SU5F748aWzGDWl0 Ji5sfQro6aRWg3KbdHEd3eDt919MzSL3m3nyPkT1tgu5lUOYaNe5mvMv7kJZugu4ipgi VQpiJGxcr3mpwvQoT19iFlLOQmMV+GpjWcngLuaVmk6Jf/NDujxyJ9OFAM39fiWwFjA8 uIJs8kYvOMxAyzPhPsB/mCLhE3IvGuLjuQL18ZfouT1sUzcXFAeVCYi81bgL0e0LYy3f dsJ1X8PZiG6vLBG3R0oLQvindIC1tBnTa+aztb9T2iNTFjsASmLEMhCoHm8Aihkb/VrH C5NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=K89B6aV1CkjPvRNvgMYHKVQus6duWMVAFBkGJinZogU=; b=ZBdRkfiPPY5UAZRVSZM+QebL+M4pdXC5iUmdtflnTue+CRtZJTWELlHRB9A0+y4MLe jWIfvinYSctLU+NX7orwRpu4GfZLdj8xHLsXF636+KcD9y2QPWqQ/WdUVMYl2qsV692a ttfEfn+UWZ66yajbex1Ke/jGzoIvTS++6AXjD5KRCpuyRXA8Oij7TZ6QcGYMCgC0cjH1 UJFkbUSIfqoczqFuONUk7HeRbXeg2dkeov041ynaESvDn5/BbZghJ7kjgo3ZrRoBFM3U koOaBnxJY9sUNYFSl2rm24JcyojK1KxI2WfCQMqQT2xYmEQeo+vKiiuZDo/OJWTKuT6B M4Nw== X-Gm-Message-State: AKaTC015FgMcX515NlUGuNC9bkxYAzitRf4SdT7KDcgsZpOMAFApVSGvFeHl4mJprRKEdA== X-Received: by 10.202.85.72 with SMTP id j69mr25984402oib.97.1480787942266; Sat, 03 Dec 2016 09:59:02 -0800 (PST) Received: from fainelli-laptop.lan ([2001:470:d:73f:7cb8:730d:76b0:6c10]) by smtp.gmail.com with ESMTPSA id t42sm3440786ota.24.2016.12.03.09.59.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 03 Dec 2016 09:59:01 -0800 (PST) From: Florian Fainelli To: lede-dev@lists.infradead.org Date: Sat, 3 Dec 2016 09:58:55 -0800 Message-Id: <20161203175855.6262-1-f.fainelli@gmail.com> X-Mailer: git-send-email 2.9.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161203_095924_041556_E8A6D4C7 X-CRM114-Status: UNSURE ( 9.71 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:4003:c06: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 (f.fainelli[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_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid Subject: [LEDE-DEV] [PATCH uclient] Fix unused results warnings 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: Florian Fainelli MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Fixes: uclient-http.c:385:8: error: ignoring return value of 'fread', declared with attribute warn_unused_result [-Werror=unused-result] fread(&val, sizeof(val), 1, f); ^ uclient-fetch.c: In function 'main': uclient-fetch.c:664:12: error: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Werror=unused-result] asprintf(&auth_str, "%s:%s", username, password); ^ uclient-fetch.c: In function 'read_data_cb': uclient-fetch.c:269:9: error: ignoring return value of 'write', declared with attribute warn_unused_result [-Werror=unused-result] write(output_fd, buf, len); Signed-off-by: Florian Fainelli --- uclient-fetch.c | 16 +++++++++++----- uclient-http.c | 5 ++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/uclient-fetch.c b/uclient-fetch.c index 4c603fbc1945..db13e81bf8d0 100644 --- a/uclient-fetch.c +++ b/uclient-fetch.c @@ -254,6 +254,7 @@ static void header_done_cb(struct uclient *cl) static void read_data_cb(struct uclient *cl) { char buf[256]; + size_t n; int len; if (!no_output && output_fd < 0) @@ -265,8 +266,11 @@ static void read_data_cb(struct uclient *cl) return; out_bytes += len; - if (!no_output) - write(output_fd, buf, len); + if (!no_output) { + n = write(output_fd, buf, len); + if (n < len) + return; + } } } @@ -660,9 +664,11 @@ int main(int argc, char **argv) uloop_init(); if (username) { - if (password) - asprintf(&auth_str, "%s:%s", username, password); - else + if (password) { + rc = asprintf(&auth_str, "%s:%s", username, password); + if (rc < 0) + return rc; + } else auth_str = username; } diff --git a/uclient-http.c b/uclient-http.c index 8d26bd4884be..80f40d0e40e3 100644 --- a/uclient-http.c +++ b/uclient-http.c @@ -379,11 +379,14 @@ get_cnonce(char *dest) { uint32_t val = 0; FILE *f; + size_t n; f = fopen("/dev/urandom", "r"); if (f) { - fread(&val, sizeof(val), 1, f); + n = fread(&val, sizeof(val), 1, f); fclose(f); + if (n != sizeof(val)) + return; } bin_to_hex(dest, &val, sizeof(val));