From patchwork Mon Mar 6 00:50:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 735508 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3vc1VW5WY3z9s7s for ; Mon, 6 Mar 2017 11:53:07 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rUneHgVZ"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="R9eV8WLz"; dkim-atps=neutral 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=qYkY8P0Lu9oG8o9zj7mbkgnAjEWn9paFTDVq1l1oNXo=; b=rUneHgVZpFHW7F 4MeEefnUevo8NB7BqWUWIkFfvTe5L/gDN/YhhpG+TXjhk5R6MV4SYc18a5tO9Dvdyaw9nl+P3lfYp fZAd9bkalYDD0FpB/mzcBDK+lYpAC1Q7YuwOQAhv8GJJbF22y4no4XlGn8rkqi5IEXX27xinDd7QW telkC9Ph7QExFjw5UicnkFjZj2yb9jD66C7+82z1I71kLy9x3gKZO7lJ/J9mpBmnqgEbsZLbh6pYu vz75rQbGl9ileii3tE+J1RV8cekVlT4OTReAMxr629I+QzoaRxN/rs6iEXMWY5MVZqRSR2oT2O0pB chdvYQcxgR47os/b1rQQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ckgtU-0007lm-7P; Mon, 06 Mar 2017 00:52:56 +0000 Received: from mail-oi0-x241.google.com ([2607:f8b0:4003:c06::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ckgrM-0006bb-Hz for lede-dev@lists.infradead.org; Mon, 06 Mar 2017 00:50:48 +0000 Received: by mail-oi0-x241.google.com with SMTP id 2so11529308oif.0 for ; Sun, 05 Mar 2017 16:50:20 -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=6uJRgRoJft/G7YG0l1nOAvNLkedlRQhFXSTmbkC2tIs=; b=R9eV8WLzCOLwovWMNwEWEDmaM4uazZ81VBCCkVZMVqtdxho58ip/ZIG5ZqmbEcHr0t aClMLFOE17nasKdKHPpR6XF3KZ92Fr1jfdzlfCxOM0BDbYYuErvbplwIp/bBkqhGLqYa IPybO1pdd/A08wNAuTYYnroMt/heNKjZQWsT49d/xpAsHVPml+eb/pPacQYeueTuslni VqcJUouuPDBV8eemHzH851p2h6gW+Vsay1cndN99MweyDuOBbznJPWyY5+kCk3EbRF+0 kATm3TwkPFsESzmj9lQhTBrJhFaFTxJ/v29MA514edhgTXJVt2Js/IVfO71yDcIrl7z3 lPFw== 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=6uJRgRoJft/G7YG0l1nOAvNLkedlRQhFXSTmbkC2tIs=; b=dcP7K9m89KVjBT1z94BUluDjzAPpvNAGu2KoOvL9X6xyPr7bI1km0EZRJ9x08PCj7S kZnms3yyCG1FoAIY6xz10ZfT5tiXLVlF5zcg5sP3rCKk9f47Bu/kCnow+HuEczEVYPl8 bhWQjqW05zLWI+8vDbHT5/dFmKVUAM5KH4k4NXmeeQqEqQryqG9fipf2yeFhTfQ8BfH+ 4/SHtygUbg4iYgXYFhOzd3NZY4ZjiBc/bOk+rK2kgbfc4pxrE76Fi7qMzxhPkQHUmilF FerQCVeRvTBZSzSw0ptAjpGp6G6xYmuXmFbzqSDwDcFPxqKbm3GaXNx/l4SXoxapoJTm pe3g== X-Gm-Message-State: AMke39lsXxeG5BGbJH9n1jk1fx/Xr7IbVJzi3O0IMdVJmaa7sgj8pQlu8NeKExdfxTjUtg== X-Received: by 10.202.108.18 with SMTP id h18mr6173046oic.158.1488761420325; Sun, 05 Mar 2017 16:50:20 -0800 (PST) Received: from fainelli-laptop.lan ([2001:470:d:73f:a116:863b:e34d:e904]) by smtp.gmail.com with ESMTPSA id s11sm8073672oia.15.2017.03.05.16.50.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Mar 2017 16:50:19 -0800 (PST) From: Florian Fainelli To: lede-dev@lists.infradead.org Date: Sun, 5 Mar 2017 16:50:12 -0800 Message-Id: <20170306005016.21123-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170306005016.21123-1-f.fainelli@gmail.com> References: <20170306005016.21123-1-f.fainelli@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170305_165047_182955_499A1474 X-CRM114-Status: GOOD ( 10.46 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.1 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 mountd 1/5] mountd: Fix unused results warnings in autofs.c for chdir() 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: Florian Fainelli , john@phrozen.org MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Fixes the following warnings: mountd-2016-12-19-dd5799c9/autofs.c: In function 'autofs_loop': mountd-2016-12-19-dd5799c9/autofs.c:227:7: error: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Werror=unused-result] chdir("/"); ^ mountd-2016-12-19-dd5799c9/autofs.c: In function 'autofs_process_request': mountd-2016-12-19-dd5799c9/autofs.c:100:7: error: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Werror=unused-result] chdir("/tmp/run/mountd/"); ^ mountd-2016-12-19-dd5799c9/autofs.c:112:7: error: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Werror=unused-result] chdir("/"); Signed-off-by: Florian Fainelli --- autofs.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/autofs.c b/autofs.c index 8c69cbea5c76..f77b929ab7ce 100644 --- a/autofs.c +++ b/autofs.c @@ -95,9 +95,12 @@ static void send_fail(unsigned int wait_queue_token) static int autofs_process_request(const struct autofs_v5_packet *pkt) { + int ret; struct stat st; log_printf("kernel is requesting a mount -> %s\n", pkt->name); - chdir("/tmp/run/mountd/"); + ret = chdir("/tmp/run/mountd/"); + if (ret < 0) + return ret; if (lstat(pkt->name, &st) == -1 || (S_ISDIR(st.st_mode) && st.st_dev == dev)) { if(!mount_new("/tmp/run/mountd/", (char*)pkt->name)) { @@ -109,9 +112,7 @@ static int autofs_process_request(const struct autofs_v5_packet *pkt) } else { send_ready(pkt->wait_queue_token); } - chdir("/"); - - return 0; + return chdir("/"); } static void expire_proc(void) @@ -224,7 +225,10 @@ static void autofs_init(void) int autofs_loop(void) { - chdir("/"); + int ret; + ret = chdir("/"); + if (ret < 0) + return 1; autofs_init(); while(1) { @@ -234,9 +238,11 @@ int autofs_loop(void) continue; } log_printf("Got a autofs packet\n"); - if(pkt.hdr.type == autofs_ptype_missing_indirect) - autofs_process_request(&pkt.missing_indirect); - else + if(pkt.hdr.type == autofs_ptype_missing_indirect) { + ret = autofs_process_request(&pkt.missing_indirect); + if (ret < 0) + return 1; + } else log_printf("unknown packet type %d\n", pkt.hdr.type); poll(0, 0, 200); }