Tcl Source Code

Check-in [5a5e87fae7]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix missing CLOEXEC on internal pipes [2417695] and [chan pipe] fds.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5a5e87fae77756c9fe595a728421dd9af747e38d
User & Date: ferrieux 2008-12-12 16:07:17
Context
2008-12-12
16:18
Make a bad zlib install less fatal to rest of Tcl for now. check-in: 727529ef0e user: dkf tags: trunk
16:07
Fix missing CLOEXEC on internal pipes [2417695] and [chan pipe] fds. check-in: 5a5e87fae7 user: ferrieux tags: trunk
15:06
Let code extract gzip headers check-in: b0c7b90bc3 user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.






1
2
3
4
5
6
7





2008-12-12  Donal K. Fellows  <[email protected]>

	* generic/tclZlib.c (Tcl_ZlibDeflate): Add a bit of extra space for
	the gzip header. [Bug 2419061]
	(Tcl_ZlibInflate): Ensure that gzip header extraction is done
	correctly.

>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
2008-12-12  Alexandre Ferrieux 	<[email protected]>

	* unix/tclUnixNotfy.c  Fix missing CLOEXEC on internal pipes [2417695]
	* unix/tclUnixPipe.c   Fix missing CLOEXEC on [chan pipe] fds.
	
2008-12-12  Donal K. Fellows  <[email protected]>

	* generic/tclZlib.c (Tcl_ZlibDeflate): Add a bit of extra space for
	the gzip header. [Bug 2419061]
	(Tcl_ZlibInflate): Ensure that gzip header extraction is done
	correctly.

Changes to unix/tclUnixNotfy.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * tclUnixNotify.c --
 *
 *	This file contains the implementation of the select()-based
 *	Unix-specific notifier, which is the lowest-level part of the Tcl
 *	event loop. This file works together with generic/tclNotify.c.
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclUnixNotfy.c,v 1.37 2008/10/26 12:45:04 dkf Exp $
 */

#include "tclInt.h"
#ifndef HAVE_COREFOUNDATION	/* Darwin/Mac OS X CoreFoundation notifier is
				 * in tclMacOSXNotify.c */
#include <signal.h>













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * tclUnixNotify.c --
 *
 *	This file contains the implementation of the select()-based
 *	Unix-specific notifier, which is the lowest-level part of the Tcl
 *	event loop. This file works together with generic/tclNotify.c.
 *
 * Copyright (c) 1995-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclUnixNotfy.c,v 1.38 2008/12/12 16:07:18 ferrieux Exp $
 */

#include "tclInt.h"
#ifndef HAVE_COREFOUNDATION	/* Darwin/Mac OS X CoreFoundation notifier is
				 * in tclMacOSXNotify.c */
#include <signal.h>

933
934
935
936
937
938
939






940
941
942
943
944
945
946

    if (TclUnixSetBlockingMode(receivePipe, TCL_MODE_NONBLOCKING) < 0) {
	Tcl_Panic("NotifierThreadProc: could not make receive pipe non blocking");
    }
    if (TclUnixSetBlockingMode(fds[1], TCL_MODE_NONBLOCKING) < 0) {
	Tcl_Panic("NotifierThreadProc: could not make trigger pipe non blocking");
    }







    /*
     * Install the write end of the pipe into the global variable.
     */

    Tcl_MutexLock(&notifierMutex);
    triggerPipe = fds[1];







>
>
>
>
>
>







933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952

    if (TclUnixSetBlockingMode(receivePipe, TCL_MODE_NONBLOCKING) < 0) {
	Tcl_Panic("NotifierThreadProc: could not make receive pipe non blocking");
    }
    if (TclUnixSetBlockingMode(fds[1], TCL_MODE_NONBLOCKING) < 0) {
	Tcl_Panic("NotifierThreadProc: could not make trigger pipe non blocking");
    }
    if (fcntl(receivePipe, F_SETFD, FD_CLOEXEC) < 0) {
	Tcl_Panic("NotifierThreadProc: could not make receive pipe close-on-exec");
    }
    if (fcntl(fds[1], F_SETFD, FD_CLOEXEC) < 0) {
	Tcl_Panic("NotifierThreadProc: could not make trigger pipe close-on-exec");
    }

    /*
     * Install the write end of the pipe into the global variable.
     */

    Tcl_MutexLock(&notifierMutex);
    triggerPipe = fds[1];

Changes to unix/tclUnixPipe.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * tclUnixPipe.c --
 *
 *	This file implements the UNIX-specific exec pipeline functions, the
 *	"pipe" channel driver, and the "pid" Tcl command.
 *
 * Copyright (c) 1991-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclUnixPipe.c,v 1.44 2008/07/21 21:46:47 das Exp $
 */

#include "tclInt.h"

#ifdef USE_VFORK
#define fork vfork
#endif












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * tclUnixPipe.c --
 *
 *	This file implements the UNIX-specific exec pipeline functions, the
 *	"pipe" channel driver, and the "pid" Tcl command.
 *
 * Copyright (c) 1991-1994 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: tclUnixPipe.c,v 1.45 2008/12/12 16:07:18 ferrieux Exp $
 */

#include "tclInt.h"

#ifdef USE_VFORK
#define fork vfork
#endif
793
794
795
796
797
798
799



800
801
802
803
804
805
806
    int fileNums[2];

    if (pipe(fileNums) < 0) {
	Tcl_AppendResult(interp, "pipe creation failed: ",
		Tcl_PosixError(interp), NULL);
	return TCL_ERROR;
    }




    *rchan = Tcl_MakeFileChannel((ClientData) INT2PTR(fileNums[0]),
	    TCL_READABLE);
    Tcl_RegisterChannel(interp, *rchan);
    *wchan = Tcl_MakeFileChannel((ClientData) INT2PTR(fileNums[1]),
	    TCL_WRITABLE);
    Tcl_RegisterChannel(interp, *wchan);







>
>
>







793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
    int fileNums[2];

    if (pipe(fileNums) < 0) {
	Tcl_AppendResult(interp, "pipe creation failed: ",
		Tcl_PosixError(interp), NULL);
	return TCL_ERROR;
    }

    fcntl(fileNums[0], F_SETFD, FD_CLOEXEC);
    fcntl(fileNums[1], F_SETFD, FD_CLOEXEC);

    *rchan = Tcl_MakeFileChannel((ClientData) INT2PTR(fileNums[0]),
	    TCL_READABLE);
    Tcl_RegisterChannel(interp, *rchan);
    *wchan = Tcl_MakeFileChannel((ClientData) INT2PTR(fileNums[1]),
	    TCL_WRITABLE);
    Tcl_RegisterChannel(interp, *wchan);