diff options
author | hobbs <hobbs> | 2004-02-17 23:46:52 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2004-02-17 23:46:52 (GMT) |
commit | 57bfc576f44e79000d9d4b77974c6b4dbad662d4 (patch) | |
tree | 57a631b8cb81d611eaec8f4a1ac52d4836a046ec /unix/tclUnixInit.c | |
parent | 36fd8f61b581d7e997b9d65e92656fe72ce59230 (diff) | |
download | tcl-57bfc576f44e79000d9d4b77974c6b4dbad662d4.zip tcl-57bfc576f44e79000d9d4b77974c6b4dbad662d4.tar.gz tcl-57bfc576f44e79000d9d4b77974c6b4dbad662d4.tar.bz2 |
* tests/unixInit.test: unixInit-7.1
* unix/tclUnixInit.c (TclpInitPlatform): ensure the std fds exist
to prevent crash condition [Bug #772288]
Diffstat (limited to 'unix/tclUnixInit.c')
-rw-r--r-- | unix/tclUnixInit.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/unix/tclUnixInit.c b/unix/tclUnixInit.c index ff033ee..d0dfd28 100644 --- a/unix/tclUnixInit.c +++ b/unix/tclUnixInit.c @@ -7,7 +7,7 @@ * Copyright (c) 1999 by Scriptics Corporation. * All rights reserved. * - * RCS: @(#) $Id: tclUnixInit.c,v 1.34.2.2 2003/11/10 20:32:34 dgp Exp $ + * RCS: @(#) $Id: tclUnixInit.c,v 1.34.2.3 2004/02/17 23:46:54 hobbs Exp $ */ #if defined(HAVE_CFBUNDLE) @@ -170,6 +170,19 @@ TclpInitPlatform() tclPlatform = TCL_PLATFORM_UNIX; /* + * Make sure, that the standard FDs exist. [Bug 772288] + */ + if (TclOSseek(0, (Tcl_SeekOffset) 0, SEEK_CUR) == -1 && errno == EBADF) { + open("/dev/null", O_RDONLY); + } + if (TclOSseek(1, (Tcl_SeekOffset) 0, SEEK_CUR) == -1 && errno == EBADF) { + open("/dev/null", O_WRONLY); + } + if (TclOSseek(2, (Tcl_SeekOffset) 0, SEEK_CUR) == -1 && errno == EBADF) { + open("/dev/null", O_WRONLY); + } + + /* * The code below causes SIGPIPE (broken pipe) errors to * be ignored. This is needed so that Tcl processes don't * die if they create child processes (e.g. using "exec" or |