Browse Source

Silence unused result warnings for notifier_{read,wake}

Luke Dashjr 12 years ago
parent
commit
d298890824
2 changed files with 9 additions and 4 deletions
  1. 7 4
      util.c
  2. 2 0
      util.h

+ 7 - 4
util.c

@@ -2213,20 +2213,23 @@ void notifier_wake(notifier_t fd)
 {
 	if (fd[1] == INVSOCK)
 		return;
+	if (1 !=
 #ifdef WIN32
-	(void)send(fd[1], "\0", 1, 0);
+	send(fd[1], "\0", 1, 0)
 #else
-	(void)write(fd[1], "\0", 1);
+	write(fd[1], "\0", 1)
 #endif
+	)
+		applog(LOG_WARNING, "Error trying to wake notifier");
 }
 
 void notifier_read(notifier_t fd)
 {
 	char buf[0x10];
 #ifdef WIN32
-	(void)recv(fd[0], buf, sizeof(buf), 0);
+	IGNORE_RETURN_VALUE(recv(fd[0], buf, sizeof(buf), 0));
 #else
-	(void)read(fd[0], buf, sizeof(buf));
+	IGNORE_RETURN_VALUE(read(fd[0], buf, sizeof(buf)));
 #endif
 }
 

+ 2 - 0
util.h

@@ -49,6 +49,8 @@
 	#endif
 #endif
 
+#define IGNORE_RETURN_VALUE(expr)  {if(expr);}(void)0
+
 #if JANSSON_MAJOR_VERSION >= 2
 #define JSON_LOADS(str, err_ptr) json_loads((str), 0, (err_ptr))
 #else