]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdmon: wait_and_act: fix debug message for SIGUSR1
authorMartin Wilck <mwilck@arcor.de>
Tue, 30 Jul 2013 21:18:31 +0000 (23:18 +0200)
committerNeilBrown <neilb@suse.de>
Wed, 31 Jul 2013 02:59:40 +0000 (12:59 +1000)
Correctly print out wake reason if it was a signal. Previous code
would print misleading select events (pselect(2) man page says the
fdsets become undefined in case of error).

Signed-off-by: Martin Wilck <mwilck@arcor.de>
Signed-off-by: NeilBrown <neilb@suse.de>
monitor.c

index 780b6099939b7e9cc6a539a5742032a194afb2f6..742aa196fb3b2214a89a15ccb9124b832e2c587d 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -640,10 +640,17 @@ static int wait_and_act(struct supertype *container, int nowait)
                monitor_loop_cnt |= 1;
                rv = pselect(maxfd+1, NULL, NULL, &rfds, &ts, &set);
                monitor_loop_cnt += 1;
-               if (rv == -1 && errno == EINTR)
-                       rv = 0;
+               if (rv == -1) {
+                       if (errno == EINTR) {
+                               rv = 0;
+                               dprintf("monitor: caught signal\n");
+                       } else
+                               dprintf("monitor: error %d in pselect\n",
+                                       errno);
+               }
                #ifdef DEBUG
-               dprint_wake_reasons(&rfds);
+               else
+                       dprint_wake_reasons(&rfds);
                #endif
                container->retry_soon = 0;
        }