From f9dedbb90347ee4d4634fc4691ff3665438f100b Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Tue, 15 Jul 2008 23:51:16 +1200 Subject: [PATCH] Supercede b8856: old compiler support Seems the (void) casting method indicated as the best method to fix unused return warning does not actually work. :-( Of the other approaches, I'm picking this one used previously by the SuSE Linux port of Squid as the cleanest. Thanks Michael Bienia from the Ubuntu team for assistance testing. --- lib/util.c | 4 ++-- src/StoreIOBuffer.h | 4 ++-- src/comm.cc | 2 +- src/tools.cc | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/util.c b/lib/util.c index 4e7ec2518a..8f48a267f4 100644 --- a/lib/util.c +++ b/lib/util.c @@ -931,8 +931,8 @@ xint64toa(int64_t num) void default_failure_notify(const char *message) { - (void)write(2, message, strlen(message)); - (void)write(2, "\n", 1); + if(write(2, message, strlen(message))) {} + if(write(2, "\n", 1)) {} abort(); } diff --git a/src/StoreIOBuffer.h b/src/StoreIOBuffer.h index 8649e15063..058fd3fc63 100644 --- a/src/StoreIOBuffer.h +++ b/src/StoreIOBuffer.h @@ -68,8 +68,8 @@ public: void dump() const { - (void)fwrite(data, length, 1, stderr); - (void)fwrite("\n", 1, 1, stderr); + if(fwrite(data, length, 1, stderr)) {} + if(fwrite("\n", 1, 1, stderr)) {} } struct diff --git a/src/comm.cc b/src/comm.cc index 212b6bae4c..5eecf5601d 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -2220,7 +2220,7 @@ comm_accept(int fd, IOACB *handler, void *handler_data) { void CommIO::Initialise() { /* Initialize done pipe signal */ int DonePipe[2]; - (void)pipe(DonePipe); + if(pipe(DonePipe)) {} DoneFD = DonePipe[1]; DoneReadFD = DonePipe[0]; fd_open(DoneReadFD, FD_PIPE, "async-io completetion event: main"); diff --git a/src/tools.cc b/src/tools.cc index 93e9d0dfd6..ca8d6a8bbc 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -152,7 +152,7 @@ mail_warranty(void) snprintf(command, 256, "%s %s < %s", Config.EmailProgram, Config.adminEmail, filename); - (void)system(command); /* XXX should avoid system(3) */ + if(system(command)) {} /* XXX should avoid system(3) */ unlink(filename); } -- 2.47.2