From patchwork Sun Dec 4 23:15: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: 702508 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 3tX3hr1r4wz9t0Z for ; Mon, 5 Dec 2016 10:18:04 +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="XpmfQOgt"; 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 1cDg1A-0001IY-7T; Sun, 04 Dec 2016 23:16:24 +0000 Received: from mail-oi0-x244.google.com ([2607:f8b0:4003:c06::244]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cDg15-0001Ez-UF for lede-dev@lists.infradead.org; Sun, 04 Dec 2016 23:16:20 +0000 Received: by mail-oi0-x244.google.com with SMTP id f201so34356016oib.0 for ; Sun, 04 Dec 2016 15:15:59 -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=Oo7A3yQX3qnGBxlC5NMFX5m/O9bkmYCT+ueY8pNzz2E=; b=XpmfQOgt/ZzlidkyuEv51jbv0S8P05MnOL+quyU5V44iOl4X2WH31gpTO63RnaL0q6 QCz5sT45aCiPyhLydtadddd5Ps8gmi2C8rGBpC0CC7DcBS4ZdKNYuZdECjHpiOGzQdbB XrtUfZnKKdD71ysAzd7eLj6/XseOOGfbGewQ1Xcw7sNDCPdTQ8itq8rvigBueZbcEce0 nCLpFquCEBHh0wFfHJqX0FBs/xu7GFOP+Sj6jB9AriP/+2EWkT2P684HhpoPFI4CKGFq dR80UgW3D/7vfF3qMwFj4qDAR70vUbXU+SQe9+vafl1SDdJIcwNcM4RylwQRWXgpeN4C dS8Q== 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=Oo7A3yQX3qnGBxlC5NMFX5m/O9bkmYCT+ueY8pNzz2E=; b=i1oJGDwSLkI1GCxkn+VO1KSsG8O5Ik4P/NVv2xqDum9o4ZMRB3hEx+00BlWvCGj2LL VZp0plMtQDeMyWzBEhlyl6tDDL4s6h3xqUAgZYfzz0T9Jnb43X+ERJ/gjPwmMnxoqkAh ii1nAPYPlyHBa2HyW9Z76Sv0WQfzk4L60AhJ9onLYzVemN/9hI9X+UOgKz71iFAGmMhl R9RqCpSvRNWsk6G4S6X+wktPDtcQNpZgyoveG3aICAe5KNpnLKqlGE26OaQAWTWNjaRJ DEu+mHKY8oRw8W+NxJnYMs/3eLH7xW+9gUAmd9tgKJ3CIQx/QNOhlLVM4FeH+1oA6Vxa dtOQ== X-Gm-Message-State: AKaTC03tezX5xMweDzQX4S1GuJ8+2GId1XGxKPxAI1nwV//WYDGjjby0dnmhyr5wsChdZw== X-Received: by 10.157.24.50 with SMTP id b47mr32785921ote.161.1480893358377; Sun, 04 Dec 2016 15:15:58 -0800 (PST) Received: from fainelli-laptop.lan ([2001:470:d:73f:7cb8:730d:76b0:6c10]) by smtp.gmail.com with ESMTPSA id 90sm5122751otw.15.2016.12.04.15.15.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Dec 2016 15:15:57 -0800 (PST) From: Florian Fainelli To: lede-dev@lists.infradead.org Date: Sun, 4 Dec 2016 15:15:55 -0800 Message-Id: <20161204231555.14118-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-20161204_151620_094434_14A65C87 X-CRM114-Status: GOOD ( 10.24 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.0 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:4003:c06: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 (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 v2] 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..16fd3ca0c345 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 < 0) + 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..ac9d50f4b2ad 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 != 1) + return; } bin_to_hex(dest, &val, sizeof(val));