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

Comparing rxvt-unicode/src/init.C (file contents):
Revision 1.144 by root, Tue Jan 17 11:02:10 2006 UTC vs.
Revision 1.146 by root, Tue Jan 17 15:17:39 2006 UTC

1370rxvt_term::run_command (const char *const *argv) 1370rxvt_term::run_command (const char *const *argv)
1371{ 1371{
1372#if ENABLE_FRILLS 1372#if ENABLE_FRILLS
1373 if (rs[Rs_pty_fd]) 1373 if (rs[Rs_pty_fd])
1374 { 1374 {
1375 pty.pty = atoi (rs[Rs_pty_fd]); 1375 pty->pty = atoi (rs[Rs_pty_fd]);
1376 1376
1377 if (pty.pty >= 0) 1377 if (pty->pty >= 0)
1378 { 1378 {
1379 if (getfd_hook) 1379 if (getfd_hook)
1380 pty.pty = (*getfd_hook) (pty.pty); 1380 pty->pty = (*getfd_hook) (pty->pty);
1381 1381
1382 if (pty.pty < 0 || fcntl (pty.pty, F_SETFL, O_NONBLOCK)) 1382 if (pty->pty < 0 || fcntl (pty->pty, F_SETFL, O_NONBLOCK))
1383 rxvt_fatal ("unusable pty-fd filehandle, aborting.\n"); 1383 rxvt_fatal ("unusable pty-fd filehandle, aborting.\n");
1384 } 1384 }
1385 } 1385 }
1386 else 1386 else
1387#endif 1387#endif
1388 if (!pty.get ()) 1388 if (!pty->get ())
1389 rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); 1389 rxvt_fatal ("can't initialize pseudo-tty, aborting.\n");
1390 1390
1391 pty.set_utf8_mode (enc_utf8); 1391 pty->set_utf8_mode (enc_utf8);
1392 1392
1393 /* set initial window size */ 1393 /* set initial window size */
1394 tt_winch (); 1394 tt_winch ();
1395 1395
1396 int er; 1396 int er;
1420 rxvt_fatal ("can't fork, aborting.\n"); 1420 rxvt_fatal ("can't fork, aborting.\n");
1421 } 1421 }
1422 case 0: 1422 case 0:
1423 init_env (); 1423 init_env ();
1424 1424
1425 if (!pty.make_controlling_tty ()) 1425 if (!pty->make_controlling_tty ())
1426 fprintf (stderr, "%s: could not obtain control of tty.", RESNAME); 1426 fprintf (stderr, "%s: could not obtain control of tty.", RESNAME);
1427 else 1427 else
1428 { 1428 {
1429 /* Reopen stdin, stdout and stderr over the tty file descriptor */ 1429 /* Reopen stdin, stdout and stderr over the tty file descriptor */
1430 dup2 (pty.tty, STDIN_FILENO); 1430 dup2 (pty->tty, STDIN_FILENO);
1431 dup2 (pty.tty, STDOUT_FILENO); 1431 dup2 (pty->tty, STDOUT_FILENO);
1432 dup2 (pty.tty, STDERR_FILENO); 1432 dup2 (pty->tty, STDERR_FILENO);
1433 1433
1434 // close all our file handles that we do no longer need 1434 // close all our file handles that we do no longer need
1435 for (rxvt_term **t = termlist.begin (); t < termlist.end (); t++) 1435 for (rxvt_term **t = termlist.begin (); t < termlist.end (); t++)
1436 { 1436 {
1437 if ((*t)->pty.pty > 2) close ((*t)->pty.pty); 1437 if ((*t)->pty->pty > 2) close ((*t)->pty->pty);
1438 if ((*t)->pty.tty > 2) close ((*t)->pty.tty); 1438 if ((*t)->pty->tty > 2) close ((*t)->pty->tty);
1439 } 1439 }
1440 1440
1441 run_child (argv); 1441 run_child (argv);
1442 fprintf (stderr, "%s: unable to exec child.", RESNAME); 1442 fprintf (stderr, "%s: unable to exec child.", RESNAME);
1443 } 1443 }
1444 1444
1445 _exit (EXIT_FAILURE); 1445 _exit (EXIT_FAILURE);
1446 1446
1447 default: 1447 default:
1448 { 1448 if (!OPTION (Opt_utmpInhibit))
1449#if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT) 1449 pty->login (cmd_pid, OPTION (Opt_loginShell), rs[Rs_display_name]);
1450 int fdstdin;
1451 1450
1452 fdstdin = dup (STDIN_FILENO); 1451 pty->close_tty ();
1453 dup2 (pty.tty, STDIN_FILENO);
1454#endif
1455
1456#ifdef UTMP_SUPPORT
1457 privileged_utmp (SAVE);
1458#endif
1459
1460#if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT)
1461
1462 dup2 (fdstdin, STDIN_FILENO);
1463 close (fdstdin);
1464#endif
1465 }
1466
1467 pty.close_tty (); /* keep STDERR_FILENO, pty.pty, display->fd () open */
1468 break; 1452 break;
1469 } 1453 }
1470} 1454}
1471 1455
1472/* ------------------------------------------------------------------------- * 1456/* ------------------------------------------------------------------------- *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines