/[baselayout]/trunk/src/rc.c
Gentoo

Diff of /trunk/src/rc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2641 Revision 2642
333 333
334static char read_key (bool block) 334static char read_key (bool block)
335{ 335{
336 struct termios termios; 336 struct termios termios;
337 char c = 0; 337 char c = 0;
338 338
339 if (! isatty (STDIN_FILENO)) 339 if (! isatty (STDIN_FILENO))
340 return (false); 340 return (false);
341 341
342 /* Now save our terminal settings. We need to restore them at exit as we 342 /* Now save our terminal settings. We need to restore them at exit as we
343 will be changing it for non-blocking reads for Interactive */ 343 will be changing it for non-blocking reads for Interactive */
396 eerrorx ("%s: vfork: %s", applet, strerror (errno)); 396 eerrorx ("%s: vfork: %s", applet, strerror (errno));
397 if (pid == 0) { 397 if (pid == 0) {
398 newenv = rc_filter_env (); 398 newenv = rc_filter_env ();
399#ifdef __linux__ 399#ifdef __linux__
400 execle ("/sbin/sulogin", "/sbin/sulogin", 400 execle ("/sbin/sulogin", "/sbin/sulogin",
401 getenv ("CONSOLE"), (char *) NULL, newenv); 401 getenv ("CONSOLE"), (char *) NULL, newenv);
402 eerror ("%s: unable to exec `/sbin/sulogin': %s", applet, 402 eerror ("%s: unable to exec `/sbin/sulogin': %s", applet,
403 strerror (errno)); 403 strerror (errno));
404#else 404#else
405 execle ("/bin/sh", "/bin/sh", (char *) NULL, newenv); 405 execle ("/bin/sh", "/bin/sh", (char *) NULL, newenv);
406 eerror ("%s: unable to exec `/bin/sh': %s", applet, 406 eerror ("%s: unable to exec `/bin/sh': %s", applet,
411 waitpid (pid, &status, 0); 411 waitpid (pid, &status, 0);
412 } else { 412 } else {
413#ifdef __linux 413#ifdef __linux
414 newenv = rc_filter_env (); 414 newenv = rc_filter_env ();
415 execle ("/sbin/sulogin", "/sbin/sulogin", 415 execle ("/sbin/sulogin", "/sbin/sulogin",
416 getenv ("CONSOLE"), (char *) NULL, newenv); 416 getenv ("CONSOLE"), (char *) NULL, newenv);
417 eerrorx ("%s: unable to exec `/sbin/sulogin': %s", applet, strerror (errno)); 417 eerrorx ("%s: unable to exec `/sbin/sulogin': %s", applet, strerror (errno));
418#else 418#else
419 exit (EXIT_SUCCESS); 419 exit (EXIT_SUCCESS);
420#endif 420#endif
421 } 421 }
526 526
527 /* Remove that pid from our list */ 527 /* Remove that pid from our list */
528 if (pid > 0) 528 if (pid > 0)
529 remove_pid (pid); 529 remove_pid (pid);
530 break; 530 break;
531 531
532 case SIGINT: 532 case SIGINT:
533 if (! signame[0]) 533 if (! signame[0])
534 snprintf (signame, sizeof (signame), "SIGINT"); 534 snprintf (signame, sizeof (signame), "SIGINT");
535 case SIGTERM: 535 case SIGTERM:
536 if (! signame[0]) 536 if (! signame[0])
540 snprintf (signame, sizeof (signame), "SIGQUIT"); 540 snprintf (signame, sizeof (signame), "SIGQUIT");
541 eerrorx ("%s: caught %s, aborting", applet, signame); 541 eerrorx ("%s: caught %s, aborting", applet, signame);
542 case SIGUSR1: 542 case SIGUSR1:
543 eerror ("rc: Aborting!"); 543 eerror ("rc: Aborting!");
544 /* Kill any running services we have started */ 544 /* Kill any running services we have started */
545 545
546 signal (SIGCHLD, SIG_IGN); 546 signal (SIGCHLD, SIG_IGN);
547 for (pl = service_pids; pl; pl = pl->next) 547 for (pl = service_pids; pl; pl = pl->next)
548 kill (pl->pid, SIGTERM); 548 kill (pl->pid, SIGTERM);
549 549
550 /* Notify plugins we are aborting */ 550 /* Notify plugins we are aborting */
551 rc_plugin_run (rc_hook_abort, "rc"); 551 rc_plugin_run (rc_hook_abort, "rc");
552 552
553 /* Only drop into single user mode if we're booting */ 553 /* Only drop into single user mode if we're booting */
554 run = getenv ("RUNLEVEL"); 554 run = getenv ("RUNLEVEL");
555 prev = getenv ("PREVLEVEL"); 555 prev = getenv ("PREVLEVEL");
556 if ((prev && strcmp (prev, "S") == 0) || 556 if ((prev && strcmp (prev, "S") == 0) ||
557 (run && 557 (run &&
558 (strcmp (run, "S") == 0 || 558 (strcmp (run, "S") == 0 ||
559 strcmp (run, "1") == 0))) 559 strcmp (run, "1") == 0)))
560 single_user (); 560 single_user ();
561 561
562 exit (EXIT_FAILURE); 562 exit (EXIT_FAILURE);
563 break; 563 break;
564 564

Legend:
Removed from v.2641  
changed lines
  Added in v.2642

  ViewVC Help
Powered by ViewVC 1.1.20