From fab9b4b050a73cd1c26d62800025d2bc11898a31 Mon Sep 17 00:00:00 2001 From: Pavel Charvat Date: Wed, 7 May 2014 09:05:12 +0200 Subject: [PATCH] Build: Silenced several compilation warnings on some versions of gcc. --- ucw/log.c | 4 +++- ucw/mainloop.c | 4 +++- ucw/shell/ucw-config.c | 2 +- ucw/shell/ucw-logger.c | 4 ++-- ucw/shell/ucw-logoutput.c | 3 ++- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ucw/log.c b/ucw/log.c index dc210385..6ac94106 100644 --- a/ucw/log.c +++ b/ucw/log.c @@ -34,7 +34,9 @@ static void NONRET do_die(void); static int default_log_handler(struct log_stream *ls UNUSED, struct log_msg *m) { // This is a completely bare version of the log-file module. Errors are ignored. - write(2, m->m, m->m_len); + if (write(2, m->m, m->m_len) < 0) + { + } return 0; } diff --git a/ucw/mainloop.c b/ucw/mainloop.c index 5fdc5ef4..f1a5fab0 100644 --- a/ucw/mainloop.c +++ b/ucw/mainloop.c @@ -534,7 +534,9 @@ signal_handler_pipe(int signum) #ifdef LOCAL_DEBUG msg(L_DEBUG | L_SIGHANDLER, "MAIN: Sigpipe: sending signal %d down the drain", signum); #endif - write(m->sig_pipe_send, &signum, sizeof(signum)); + if (write(m->sig_pipe_send, &signum, sizeof(signum)) < 0) + { + } } void diff --git a/ucw/shell/ucw-config.c b/ucw/shell/ucw-config.c index 6217ac69..e521dfa3 100644 --- a/ucw/shell/ucw-config.c +++ b/ucw/shell/ucw-config.c @@ -122,7 +122,7 @@ parse_name(void) static void parse_section(struct section *section) { -#define TRY(x) do{byte *_err=(x); if (_err) die(_err); }while(0) +#define TRY(x) do{ byte *_err=(x); if (_err) die("%s", _err); }while(0) for (uns sep = 0; ; sep = 1) { parse_white(); diff --git a/ucw/shell/ucw-logger.c b/ucw/shell/ucw-logger.c index fba6f5de..d9aa1fe8 100644 --- a/ucw/shell/ucw-logger.c +++ b/ucw/shell/ucw-logger.c @@ -37,14 +37,14 @@ main(int argc, char **argv) die("Unknown logging level `%s'", argv[2]); if (argc > 3) - msg(level, argv[3]); + msg(level, "%s", argv[3]); else while (fgets(buf, sizeof(buf), stdin)) { c = strchr(buf, '\n'); if (c) *c = 0; - msg(level, buf); + msg(level, "%s", buf); } return 0; } diff --git a/ucw/shell/ucw-logoutput.c b/ucw/shell/ucw-logoutput.c index 93afcd32..d6af0be2 100644 --- a/ucw/shell/ucw-logoutput.c +++ b/ucw/shell/ucw-logoutput.c @@ -316,7 +316,8 @@ opt_done: } } if (help) { - write(2, usage, sizeof(usage)); + if (write(2, usage, sizeof(usage)) < 0) { + } return (help == 1) ? 0 : 1; } -- 2.39.2