From e076556572ae9129807a0ae00bb63b7ff0a54807 Mon Sep 17 00:00:00 2001 From: Federico Simoncelli Date: Mon, 10 Dec 2012 17:33:58 +0100 Subject: [PATCH 5/6] wdmd: fix miscellaneous build warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed warnings: * wdmd: _FORTIFY_SOURCE requires compiling with optimization (-O) * wdmd: initialization discards ‘const’ qualifier from pointer target type * ignoring return value of ‘write’ Signed-off-by: Federico Simoncelli --- wdmd/Makefile | 2 +- wdmd/main.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wdmd/Makefile b/wdmd/Makefile index de6b035..bf871c5 100644 --- a/wdmd/Makefile +++ b/wdmd/Makefile @@ -21,7 +21,7 @@ LIB_SOURCE = client.c wdmd_sock.c TEST_SOURCE = wdmd_client.c -CFLAGS += -D_GNU_SOURCE -g \ +CFLAGS += -D_GNU_SOURCE -g -O2 \ -Wall \ -Wformat \ -Wformat-security \ diff --git a/wdmd/main.c b/wdmd/main.c index ff2d57c..8a97f04 100644 --- a/wdmd/main.c +++ b/wdmd/main.c @@ -63,8 +63,8 @@ static int shm_fd; static int allow_scripts; static int kill_script_sec; -static char *scripts_dir = (char *)"/etc/wdmd.d"; -static char *watchdog_path = "/dev/watchdog"; +static const char *scripts_dir = "/etc/wdmd.d"; +static const char *watchdog_path = "/dev/watchdog"; struct script_status { uint64_t start; @@ -1307,7 +1307,7 @@ static void print_debug_and_exit(void) if (rv < 0) exit(1); - write(STDOUT_FILENO, debug_buf, strlen(debug_buf)); + rv = write(STDOUT_FILENO, debug_buf, strlen(debug_buf)); exit(0); } -- 1.7.11.7