From patchwork Tue Jul 19 15:41:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101997 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp147915qga; Tue, 19 Jul 2016 08:42:54 -0700 (PDT) X-Received: by 10.66.161.195 with SMTP id xu3mr52017819pab.68.1468942973854; Tue, 19 Jul 2016 08:42:53 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pb1si33373730pac.1.2016.07.19.08.42.53 for ; Tue, 19 Jul 2016 08:42:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-watchdog-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-watchdog-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-watchdog-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753821AbcGSPml (ORCPT ); Tue, 19 Jul 2016 11:42:41 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:57844 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752366AbcGSPmk (ORCPT ); Tue, 19 Jul 2016 11:42:40 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue101) with ESMTPA (Nemesis) id 0LjrTN-1aoXdv0v2f-00bqn8; Tue, 19 Jul 2016 17:41:42 +0200 From: Arnd Bergmann To: Wim Van Sebroeck Cc: Arnd Bergmann , Guenter Roeck , Jonathan Corbet , Timur Tabi , linux-watchdog@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] Documentation/watchdog: check return value for magic close Date: Tue, 19 Jul 2016 17:41:22 +0200 Message-Id: <20160719154136.3132886-1-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y duTWd1IErexbzQv8 Sender: linux-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org A recent commit added a write to the watchdog test code for doing the "magic close", but that caused a compile-time warning: Documentation/watchdog/src/watchdog-test.c: In function ‘main’: Documentation/watchdog/src/watchdog-test.c:94:5: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result] This changes the code to print a runtime warning if the write fails. Fixes: 5a2d3de19602 ("Documentation/watchdog: add support for magic close to watchdog-test") Signed-off-by: Arnd Bergmann --- v2: fix typo as pointed out by both Guenter Roeck and Randy Dunlap --- Documentation/watchdog/src/watchdog-test.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/watchdog/src/watchdog-test.c b/Documentation/watchdog/src/watchdog-test.c index c69153913722..6983d05097e2 100644 --- a/Documentation/watchdog/src/watchdog-test.c +++ b/Documentation/watchdog/src/watchdog-test.c @@ -2,6 +2,7 @@ * Watchdog Driver Test Program */ +#include #include #include #include @@ -35,9 +36,13 @@ static void keep_alive(void) static void term(int sig) { - write(fd, &v, 1); + int ret = write(fd, &v, 1); + close(fd); - printf("\nStopping watchdog ticks...\n"); + if (ret < 0) + printf("\nStopping watchdog ticks failed (%d)...\n", errno); + else + printf("\nStopping watchdog ticks...\n"); exit(0); } @@ -45,6 +50,7 @@ int main(int argc, char *argv[]) { int flags; unsigned int ping_rate = 1; + int ret; setbuf(stdout, NULL); @@ -91,7 +97,9 @@ int main(int argc, char *argv[]) sleep(ping_rate); } end: - write(fd, &v, 1); + ret = write(fd, &v, 1); + if (ret < 0) + printf("Stopping watchdog ticks failed (%d)...\n", errno); close(fd); return 0; }