summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArvind Umrao <arvind.umrao@oracle.com>2012-08-24 09:44:23 +0530
committerAlan Coopersmith <alan.coopersmith@oracle.com>2012-08-24 18:25:14 -0700
commita7a54829dc89b38bbad7fcd6e70cf001d2274c26 (patch)
tree2c778f8d56a6115d4b0ec1f4a645d1b3e6d789ff
parent2e2ccc86fd4e778268ee44897a56535ce37b25e3 (diff)
Open /dev/console with NOCTTY and O_NONBLOCK flags
In some cases, for SPARC servers, special files like fifo need to open in nonblocking mode otherwise whole xconsole GUI freezes. Also /dev/console is often a terminal device. So I am opening /dev/console with NOCTTY and O_NONBLOCK flags. Signed-off-by: Arvind Umrao <arvind.umrao@oracle.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--xconsole.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/xconsole.c b/xconsole.c
index adbc298..d4b953c 100644
--- a/xconsole.c
+++ b/xconsole.c
@@ -334,7 +334,11 @@ OpenConsole(void)
regularFile = FALSE;
if (access(app_resources.file, R_OK) == 0)
{
- input = fopen (app_resources.file, "r");
+ int fd = open (app_resources.file,
+ O_RDONLY | O_NONBLOCK | O_NOCTTY);
+ if (fd != -1)
+ input = fdopen (fd, "r");
+
if (input)
if (!stat(app_resources.file, &sbuf) &&
S_ISREG( sbuf.st_mode ) )