--- policycoreutils-1.33.12/newrole/newrole.c 2007-02-20 13:32:46.000000000 -0500 +++ policycoreutils-1.33.12.ljk/newrole/newrole.c 2007-02-22 10:20:39.000000000 -0500 @@ -636,11 +636,12 @@ static int relabel_tty(const char *ttyn, } /* Re-open TTY descriptor */ - fd = open(ttyn, O_RDWR); + fd = open(ttyn, O_RDWR|O_NONBLOCK); if (fd < 0) { fprintf(stderr, _("Error! Could not open %s.\n"), ttyn); return fd; } + fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NONBLOCK); if (fgetfilecon(fd, &tty_con) < 0) { fprintf(stderr, _("%s! Could not get current context " @@ -1127,15 +1128,18 @@ int main(int argc, char *argv[]) fprintf(stderr, _("Could not close descriptors.\n")); goto err_close_pam; } - fd = open(ttyn, O_RDONLY); + fd = open(ttyn, O_RDONLY|O_NONBLOCK); if (fd != 0) goto err_close_pam; - fd = open(ttyn, O_RDWR); + fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NONBLOCK); + fd = open(ttyn, O_RDWR|O_NONBLOCK); if (fd != 1) goto err_close_pam; - fd = open(ttyn, O_RDWR); + fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NONBLOCK); + fd = open(ttyn, O_RDWR|O_NONBLOCK); if (fd != 2) goto err_close_pam; + fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NONBLOCK); /* * Step 5: Execute a new shell with the new context in `new_context'.