warn_collector: handle non-fatal signals

If we pause the process (standard SIGSTOP/SIGCONT), the read() on the
inotify handle gets angry and aborts.  This can happen if you ctrl+z
the program, or if you attach to it with strace.  This is undesirable,
so ignore EINTR errors from the read().

BUG=None
TEST=ran `./warn_collector --test` and hit ctrl+z then fg

Change-Id: I49e99abb12ace847e88f973817854d8ba95cf689
Reviewed-on: https://gerrit.chromium.org/gerrit/56303
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/crash_reporter/warn_collector.l b/crash_reporter/warn_collector.l
index 7b6575b..2f7f8ac 100644
--- a/crash_reporter/warn_collector.l
+++ b/crash_reporter/warn_collector.l
@@ -200,9 +200,16 @@
     }
     /* Nothing left to read, so we must wait. */
     struct inotify_event event;
-    int n = read(i_fd, &event, sizeof(event));
-    if (n <= 0)
-      Die("inotify: %s\n", strerror(errno));
+    while (1) {
+      int n = read(i_fd, &event, sizeof(event));
+      if (n <= 0) {
+        if (errno == EINTR)
+          continue;
+        else
+          Die("inotify: %s\n", strerror(errno));
+      } else
+        break;
+    }
     if (event.mask & IN_MOVE_SELF) {
       /* The file has been renamed.  Before switching
        * to the new one, we process any remaining