diff options
author | Damien Miller <djm@mindrot.org> | 2000-03-02 23:56:12 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-03-02 23:56:12 +1100 |
commit | 204ad074e51c0e9c25666eb044e4c255bcfe64b6 (patch) | |
tree | 4c436060e703711ea7fb31ae55329ae414cf86f8 /pty.c | |
parent | c4cea3e5c71c8f2d48ee22ea05d26a47fb47ad29 (diff) |
- Warning was valid - possible race condition on PTYs. Avoided using
platform-specific code.
- Document some common problems
Diffstat (limited to 'pty.c')
-rw-r--r-- | pty.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -14,7 +14,7 @@ | |||
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include "includes.h" | 16 | #include "includes.h" |
17 | RCSID("$Id: pty.c,v 1.13 2000/03/02 12:31:50 damien Exp $"); | 17 | RCSID("$Id: pty.c,v 1.14 2000/03/02 12:56:13 damien Exp $"); |
18 | 18 | ||
19 | #ifdef HAVE_UTIL_H | 19 | #ifdef HAVE_UTIL_H |
20 | # include <util.h> | 20 | # include <util.h> |
@@ -187,10 +187,12 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen) | |||
187 | void | 187 | void |
188 | pty_release(const char *ttyname) | 188 | pty_release(const char *ttyname) |
189 | { | 189 | { |
190 | if ((chown(ttyname, (uid_t) 0, (gid_t) 0) < 0) && (errno != ENOENT)) | 190 | #ifndef PTY_REMOVED_ON_CLOSE |
191 | if (chown(ttyname, (uid_t) 0, (gid_t) 0) < 0) | ||
191 | error("chown %.100s 0 0 failed: %.100s", ttyname, strerror(errno)); | 192 | error("chown %.100s 0 0 failed: %.100s", ttyname, strerror(errno)); |
192 | if ((chmod(ttyname, (mode_t) 0666) < 0) && (errno != ENOENT)) | 193 | if (chmod(ttyname, (mode_t) 0666) < 0) |
193 | error("chmod %.100s 0666 failed: %.100s", ttyname, strerror(errno)); | 194 | error("chmod %.100s 0666 failed: %.100s", ttyname, strerror(errno)); |
195 | #endif /* PTY_REMOVED_ON_CLOSE */ | ||
194 | } | 196 | } |
195 | 197 | ||
196 | /* Makes the tty the processes controlling tty and sets it to sane modes. */ | 198 | /* Makes the tty the processes controlling tty and sets it to sane modes. */ |