Print this page
4736 spamming zlogin with SIGINT will halt the target zone


 537                         dead = 1;
 538                         if (close_on_sig != -1) {
 539                                 (void) write(close_on_sig, "a", 1);
 540                                 (void) close(close_on_sig);
 541                                 close_on_sig = -1;
 542                         }
 543                 } else {
 544                         (void) waitpid(pid, &status, WNOHANG);
 545                 }
 546         }
 547 }
 548 
 549 /*
 550  * Some signals (currently, SIGINT) must be forwarded on to the process
 551  * group of the child process.
 552  */
 553 static void
 554 sig_forward(int s)
 555 {
 556         if (child_pid != -1) {
 557                 pid_t pgid = getpgid(child_pid);
 558                 if (pgid != -1)
 559                         (void) sigsend(P_PGID, pgid, s);
 560         }
 561 }
 562 
 563 /*
 564  * reset terminal settings for global environment
 565  */
 566 static void
 567 reset_tty()
 568 {
 569         (void) tcsetattr(save_fd, TCSADRAIN, &save_termios);
 570 }
 571 
 572 /*
 573  * Convert character to printable representation, for display with locally
 574  * echoed command characters (like when we need to display ~^D)
 575  */
 576 static void
 577 canonify(char c, char *cc)
 578 {
 579         if (isprint(c)) {




 537                         dead = 1;
 538                         if (close_on_sig != -1) {
 539                                 (void) write(close_on_sig, "a", 1);
 540                                 (void) close(close_on_sig);
 541                                 close_on_sig = -1;
 542                         }
 543                 } else {
 544                         (void) waitpid(pid, &status, WNOHANG);
 545                 }
 546         }
 547 }
 548 
 549 /*
 550  * Some signals (currently, SIGINT) must be forwarded on to the process
 551  * group of the child process.
 552  */
 553 static void
 554 sig_forward(int s)
 555 {
 556         if (child_pid != -1) {
 557                 (void) sigsend(P_PGID, child_pid, s);


 558         }
 559 }
 560 
 561 /*
 562  * reset terminal settings for global environment
 563  */
 564 static void
 565 reset_tty()
 566 {
 567         (void) tcsetattr(save_fd, TCSADRAIN, &save_termios);
 568 }
 569 
 570 /*
 571  * Convert character to printable representation, for display with locally
 572  * echoed command characters (like when we need to display ~^D)
 573  */
 574 static void
 575 canonify(char c, char *cc)
 576 {
 577         if (isprint(c)) {