[PATCH] clients: Silence 2x gcc 4.6.3 "warn_unused_result" compiler warnings

Martin Olsson martin at minimum.se
Sun Jul 8 06:42:14 PDT 2012


window.c:1173:6: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
desktop-shell.c:305:6: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
---
 clients/desktop-shell.c |    3 ++-
 clients/window.c        |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 0605f84..53dd9df 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -302,7 +302,8 @@ clock_func(struct task *task, uint32_t events)
 		container_of(task, struct panel_clock, clock_task);
 	uint64_t exp;
 
-	read(clock->clock_fd, &exp, sizeof exp);
+	if (read(clock->clock_fd, &exp, sizeof exp) != sizeof exp)
+		fprintf(stderr, "read() failed in clock_func(): %m\n");
 	widget_schedule_redraw(clock->widget);
 }
 
diff --git a/clients/window.c b/clients/window.c
index f81d06f..8c8f13a 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1170,7 +1170,8 @@ tooltip_func(struct task *task, uint32_t events)
 		container_of(task, struct tooltip, tooltip_task);
 	uint64_t exp;
 
-	read(tooltip->tooltip_fd, &exp, sizeof (uint64_t));
+	if (read(tooltip->tooltip_fd, &exp, sizeof (uint64_t)) != sizeof (uint64_t))
+		fprintf(stderr, "read() failed in tooltip_func(): %m\n");
 	window_create_tooltip(tooltip);
 }
 
-- 
1.7.9.5



More information about the wayland-devel mailing list