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 <fsimonce(a)redhat.com>
---
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 d1666b9..126524c 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;
@@ -1309,7 +1309,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
Show replies by date