ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/ptytty.C
(Generate patch)

Comparing rxvt-unicode/src/ptytty.C (file contents):
Revision 1.36 by root, Tue Jan 17 10:59:32 2006 UTC vs.
Revision 1.38 by root, Tue Jan 17 11:53:07 2006 UTC

222 * Make our tty a controlling tty so that /dev/tty points to us 222 * Make our tty a controlling tty so that /dev/tty points to us
223 */ 223 */
224static int 224static int
225control_tty (int fd_tty) 225control_tty (int fd_tty)
226{ 226{
227#ifndef __QNX__
228 int fd; 227 int fd;
229 228
230 /* ---------------------------------------- */ 229 /* ---------------------------------------- */
231# ifdef HAVE_SETSID
232 setsid (); 230 setsid ();
233# endif
234# if defined(HAVE_SETPGID)
235 setpgid (0, 0);
236# elif defined(HAVE_SETPGRP)
237 setpgrp (0, 0);
238# endif
239
240 /* ---------------------------------------- */
241# ifdef TIOCNOTTY
242 fd = open ("/dev/tty", O_RDWR | O_NOCTTY);
243 if (fd >= 0)
244 {
245 ioctl (fd, TIOCNOTTY, NULL); /* void tty associations */
246 close (fd);
247 }
248# endif
249
250 /* ---------------------------------------- */
251 fd = open ("/dev/tty", O_RDWR | O_NOCTTY);
252 if (fd >= 0)
253 close (fd); /* ouch: still have controlling tty */
254 231
255 /* ---------------------------------------- */ 232 /* ---------------------------------------- */
256# if defined(PTYS_ARE_PTMX) && defined(I_PUSH) 233# if defined(PTYS_ARE_PTMX) && defined(I_PUSH)
257 /* 234 /*
258 * Push STREAMS modules: 235 * Push STREAMS modules:
286 fd = open ("/dev/tty", O_WRONLY); 263 fd = open ("/dev/tty", O_WRONLY);
287 if (fd < 0) 264 if (fd < 0)
288 return -1; /* fatal */ 265 return -1; /* fatal */
289 close (fd); 266 close (fd);
290 /* ---------------------------------------- */ 267 /* ---------------------------------------- */
291#endif /* ! __QNX__ */
292 268
293 return 0; 269 return 0;
294} 270}
295 271
296void 272void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines