[PATCH] silence build warning

wucan wu.canus at gmail.com
Mon Jan 10 20:00:31 PST 2011


 From 5ec4fbccc16d2626e212c2bc1fdec51498b15033 Mon Sep 17 00:00:00 2001
From: wucan <wu.canus at gmail.com>
Date: Tue, 11 Jan 2011 11:45:24 +0800
Subject: silence build warning

The read()/write()/pipe() is tagged with __warn_unused_result__
---
  clients/dnd.c        |    7 ++++---
  clients/terminal.c   |   12 ++++++------
  wayland/event-loop.c |    6 ++++--
  3 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/clients/dnd.c b/clients/dnd.c
index b7f9f39..b9d0747 100644
--- a/clients/dnd.c
+++ b/clients/dnd.c
@@ -297,6 +297,7 @@ static void
  drag_finish(void *data, struct wl_drag *drag, int fd)
  {
      struct dnd_drag *dnd_drag = data;
+    int rc;

      if (!dnd_drag->mime_type) {
          dnd_add_item(dnd_drag->dnd, dnd_drag->item);
@@ -314,7 +315,7 @@ drag_finish(void *data, struct wl_drag *drag, int fd)

      fprintf(stderr, "got 'finish', fd %d, sending 
dnd_flower_message\n", fd);

-    write(fd, &dnd_flower_message, sizeof dnd_flower_message);
+    rc = write(fd, &dnd_flower_message, sizeof dnd_flower_message);
      close(fd);

      /* The 'finish' event marks the end of the session on the drag
@@ -459,7 +460,7 @@ drag_offer_drop(void *data, struct wl_drag_offer *offer)
  {
      struct dnd_offer *dnd_offer = data;
      GIOChannel *channel;
-    int p[2];
+    int p[2], rc;

      if (!dnd_offer->drag_type) {
          fprintf(stderr, "got 'drop', but no target\n");
@@ -470,7 +471,7 @@ drag_offer_drop(void *data, struct wl_drag_offer *offer)
      fprintf(stderr, "got 'drop', sending write end of pipe\n");

      dnd_offer->refcount++;
-    pipe(p);
+    rc = pipe(p);
      wl_drag_offer_receive(offer, p[1]);
      close(p[1]);

diff --git a/clients/terminal.c b/clients/terminal.c
index 1c7cbbf..596b634 100644
--- a/clients/terminal.c
+++ b/clients/terminal.c
@@ -962,7 +962,7 @@ handle_escape(struct terminal *terminal)
      union utf8_char *row;
      struct attr *attr_row;
      char *p;
-    int i, count, x, y, top, bottom;
+    int i, count, x, y, top, bottom, rc;
      int args[10], set[10] = { 0, };
      char response[MAX_RESPONSE] = {0, };

@@ -1196,7 +1196,7 @@ handle_escape(struct terminal *terminal)
          terminal->last_char.byte[0] = 0;
          break;
      case 'c':    /* Primary DA */
-        write(terminal->master, "\e[?6c", 5);
+        rc = write(terminal->master, "\e[?6c", 5);
          break;
      case 'd':    /* VPA */
          x = set[0] ? args[0] : 1;
@@ -1245,13 +1245,13 @@ handle_escape(struct terminal *terminal)
      case 'n':    /* DSR */
          i = set[0] ? args[0] : 0;
          if (i == 0 || i == 5) {
-            write(terminal->master, "\e[0n", 4);
+            rc = write(terminal->master, "\e[0n", 4);
          } else if (i == 6) {
              snprintf(response, MAX_RESPONSE, "\e[%d;%dR",
                       terminal->origin_mode ?
                       terminal->row+terminal->margin_top : terminal->row+1,
                   terminal->column+1);
-            write(terminal->master, response, strlen(response));
+            rc = write(terminal->master, response, strlen(response));
          }
           break;
      case 'r':
@@ -1679,7 +1679,7 @@ key_handler(struct window *window, uint32_t key, 
uint32_t sym,
  {
      struct terminal *terminal = data;
      char ch[MAX_RESPONSE];
-    int len = 0;
+    int len = 0, rc;

      switch (sym) {
      case XK_F11:
@@ -1796,7 +1796,7 @@ key_handler(struct window *window, uint32_t key, 
uint32_t sym,
      }

      if (state && len > 0)
-        write(terminal->master, ch, len);
+        rc = write(terminal->master, ch, len);
  }

  static void
diff --git a/wayland/event-loop.c b/wayland/event-loop.c
index bf2a9aa..bedbddb 100644
--- a/wayland/event-loop.c
+++ b/wayland/event-loop.c
@@ -160,8 +160,9 @@ wl_event_source_timer_dispatch(struct 
wl_event_source *source,
      struct wl_event_source_timer *timer_source =
          (struct wl_event_source_timer *) source;
      uint64_t expires;
+    int rc;

-    read(timer_source->fd, &expires, sizeof expires);
+    rc = read(timer_source->fd, &expires, sizeof expires);

      timer_source->func(timer_source->data);
  }
@@ -256,8 +257,9 @@ wl_event_source_signal_dispatch(struct 
wl_event_source *source,
      struct wl_event_source_signal *signal_source =
          (struct wl_event_source_signal *) source;
      struct signalfd_siginfo signal_info;
+    int rc;

-    read(signal_source->fd, &signal_info, sizeof signal_info);
+    rc = read(signal_source->fd, &signal_info, sizeof signal_info);

      signal_source->func(signal_source->signal_number, 
signal_source->data);
  }
-- 
1.7.3.2.168.gd6b63

-- 
wucan



More information about the wayland-devel mailing list