|
From: <ssm...@us...> - 2007-02-22 16:03:09
|
Revision: 2264
http://svn.sourceforge.net/selinux/?rev=2264&view=rev
Author: ssmalley
Date: 2007-02-22 08:03:05 -0800 (Thu, 22 Feb 2007)
Log Message:
-----------
Author: Linda Knippers
Email: lin...@hp...
Subject: newrole: fix for newrole hanging on some serial consoles
Date: Thu, 22 Feb 2007 10:20:45 -0500
Reposting to fix a whitespace problem and adjust the patch location.
Signed-off-by: Linda Knippers <lin...@hp...>
Modified Paths:
--------------
trunk/policycoreutils/newrole/newrole.c
Modified: trunk/policycoreutils/newrole/newrole.c
===================================================================
--- trunk/policycoreutils/newrole/newrole.c 2007-02-22 14:56:16 UTC (rev 2263)
+++ trunk/policycoreutils/newrole/newrole.c 2007-02-22 16:03:05 UTC (rev 2264)
@@ -640,11 +640,12 @@
}
/* 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 "
@@ -1131,15 +1132,18 @@
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'.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|