+
+ {
+ int fl;
+ /*
+ * Make sure that stdout/err are non-blocking.
+ */
+ if ((fl = fcntl(1, F_GETFL)) == -1 ||
+ fcntl(1, F_SETFL, fl | O_NONBLOCK) == -1) {
+ perror("stdout");
+ exit(1);
+ }
+ if ((fl = fcntl(2, F_GETFL)) == -1 ||
+ fcntl(2, F_SETFL, fl | O_NONBLOCK) == -1) {
+ perror("stderr");
+ exit(1);
+ }
+ }