From patchwork Tue Jul 19 09:24:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102003 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp572351qga; Tue, 19 Jul 2016 02:26:28 -0700 (PDT) X-Received: by 10.98.11.86 with SMTP id t83mr53017845pfi.51.1468920388325; Tue, 19 Jul 2016 02:26:28 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k69si8535940pfa.207.2016.07.19.02.26.28 for ; Tue, 19 Jul 2016 02:26:28 -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 S1752713AbcGSJ01 (ORCPT ); Tue, 19 Jul 2016 05:26:27 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:53467 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752296AbcGSJ00 (ORCPT ); Tue, 19 Jul 2016 05:26:26 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue003) with ESMTPA (Nemesis) id 0MXkt1-1btINU2kaN-00Wn5b; Tue, 19 Jul 2016 11:25:27 +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] Documentation/watchdog: check return value for magic close Date: Tue, 19 Jul 2016 11:24:50 +0200 Message-Id: <20160719092522.6397-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 X-Provags-ID: V03:K0:aUeLZez7De+wwbAhwb+R6nN+2MtbYlJ4YLmkLpoSBEIbsHnj2MP S4sBLJIkVTiW6ynnUf+m0boShnALBy9FgPu6LbL7YOKe4kVZs4jy75P6gIZtNbpw4henOGW w1LmLHwI6eoJD7AC0JUVL36lu6M4WbqqNQ81WQUeNh17dKp55MhfON10orzQ+2jCULrludY KRlKhyoxZW3nBPRFKFg+g== X-UI-Out-Filterresults: notjunk:1; V01:K0:3dVWeG5W+aY=:/cg1FmQVsKUdqLHmxpES2X MOhOfW6Hsjo3f5KvT8xMqtf+6IBnRDTNUuUfpE8H0qCo16gqaZphTvTcIorJMe4lHO3uQWpD+ MtF3ssggQEGW6UrqBH9T0x0MeD9SpVJl6A0iAgedlpKagLNlOnr+bm1+X0FjrE/JLW1AbTR2v e8EuFiezuLVTIWuoLXlONI/9d7IgqjqXL2bo/RwRATddnsQB/OW+zUgngvkcyY3j5S05tb+tF SL9GdMJhwQvaFNyhq4me+jDYwHLkNXYvTPTA2PB+K+2in8Dz7jW5L7sLWziRK0pbeCF+LMinE zjeRcgTwJNi7k4XCTycqj8J9t2nEx5UdMQfG1fO7H7zMLjqsfJLIxcD4AyPIORI4S/V+gt43S WZr0uYwcsehxy6UE78Ib9vYNyJCXD3cmElMbBigyWP1JKFLpudAsZhqvoAVSdvW79DO/Y93bi rxB6xhqBIzMV37j7EH/zhFn2kMlGljfAaaxKNbU5S0vsG6CcA4Q/OSySNPdo61YUfEUVAqlWU b7BOkbO3PCYBwWpXoxa8ma+Yaxlr1JjmeX+ZLlfSXKIz5Ykon1WzcUl0m5W3qMdjI+wkYOv2U s42AQwgL+c5Eca/DThNtS97iyr8MJ+zCWkyrSu4KozBs+DFXRsdGJtz5O97nS1UftvmwPfg+x Qwbm8c0ZyppCokvLp0J3do6fU1K2IuexQJwqwIxyZKY4r943sV+tZNIDTCDRswLKg21mPrjlR B1+fN6x+OfEs7sPX 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 --- 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..52eea54649ab 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("Sopping watchdog ticks failed (%d)...\n", errno); close(fd); return 0; }