[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r113963: * process.c (allocate_pty) [PTY_OPEN]: Set
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] trunk r113963: * process.c (allocate_pty) [PTY_OPEN]: Set fd's FD_CLOEXEC flag. |
Date: |
Wed, 21 Aug 2013 05:39:56 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 113963
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Tue 2013-08-20 22:39:51 -0700
message:
* process.c (allocate_pty) [PTY_OPEN]: Set fd's FD_CLOEXEC flag.
We can't portably rely on PTY_OPEN doing that, even if
it calls posix_openpt with O_CLOEXEC.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/process.c process.c-20091113204419-o5vbwnq5f7feedwu-462
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-08-20 14:56:03 +0000
+++ b/src/ChangeLog 2013-08-21 05:39:51 +0000
@@ -1,3 +1,9 @@
+2013-08-21 Paul Eggert <address@hidden>
+
+ * process.c (allocate_pty) [PTY_OPEN]: Set fd's FD_CLOEXEC flag.
+ We can't portably rely on PTY_OPEN doing that, even if
+ it calls posix_openpt with O_CLOEXEC.
+
2013-08-20 Kenichi Handa <address@hidden>
* character.c (string_char): Improve commentary.
=== modified file 'src/process.c'
--- a/src/process.c 2013-08-19 05:46:17 +0000
+++ b/src/process.c 2013-08-21 05:39:51 +0000
@@ -687,6 +687,15 @@
if (fd >= 0)
{
+#ifdef PTY_OPEN
+ /* Set FD's close-on-exec flag. This is needed even if
+ PT_OPEN calls posix_openpt with O_CLOEXEC, since POSIX
+ doesn't require support for that combination.
+ Multithreaded platforms where posix_openpt ignores
+ O_CLOEXEC (or where PTY_OPEN doesn't call posix_openpt)
+ have a race condition between the PTY_OPEN and here. */
+ fcntl (fd, F_SETFD, FD_CLOEXEC);
+#endif
/* check to make certain that both sides are available
this avoids a nasty yet stupid bug in rlogins */
#ifdef PTY_TTY_NAME_SPRINTF
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r113963: * process.c (allocate_pty) [PTY_OPEN]: Set fd's FD_CLOEXEC flag.,
Paul Eggert <=