sleep: Improve nanosleep() error handling:

* Work around kernel bugs that cause a spurious [EINTR] return if a
   debugger (such as truss(1)) is attached.

 * Write an error message if an error other than [EINTR] occurs.

PR:		bin/178664
This commit is contained in:
Jilles Tjoelker 2013-05-28 22:07:31 +00:00
parent c25673ffd6
commit c2cfcb6063

View File

@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <signal.h>
#include <stdint.h>
@ -87,8 +88,8 @@ main(int argc, char *argv[])
warnx("about %d second(s) left out of the original %d",
(int)time_to_sleep.tv_sec, (int)original);
report_requested = 0;
} else
break;
} else if (errno != EINTR)
err(1, "nanosleep");
}
return (0);
}