/[baselayout]/trunk/src/start-stop-daemon.c
Gentoo

Diff of /trunk/src/start-stop-daemon.c

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

Revision 2547 Revision 2563
10 */ 10 */
11 11
12#define POLL_INTERVAL 20000 12#define POLL_INTERVAL 20000
13#define START_WAIT 100000 13#define START_WAIT 100000
14 14
15#include <sys/types.h>
16#include <sys/ioctl.h>
15#include <sys/resource.h> 17#include <sys/resource.h>
16#include <sys/stat.h> 18#include <sys/stat.h>
17#include <sys/termios.h> 19#include <sys/termios.h>
18#include <sys/time.h> 20#include <sys/time.h>
19#include <sys/wait.h> 21#include <sys/wait.h>
455static void handle_signal (int sig) 457static void handle_signal (int sig)
456{ 458{
457 int pid; 459 int pid;
458 int status; 460 int status;
459 int serrno = errno; 461 int serrno = errno;
462 char signame[10] = { '\0' };
460 463
461 switch (sig) 464 switch (sig)
462 { 465 {
463 case SIGINT: 466 case SIGINT:
467 if (! signame[0])
468 snprintf (signame, sizeof (signame), "SIGINT");
464 case SIGTERM: 469 case SIGTERM:
470 if (! signame[0])
471 snprintf (signame, sizeof (signame), "SIGTERM");
465 case SIGQUIT: 472 case SIGQUIT:
473 if (! signame[0])
474 snprintf (signame, sizeof (signame), "SIGQUIT");
466 eerrorx ("%s: caught signal %d, aborting", progname, sig); 475 eerrorx ("%s: caught %s, aborting", progname, signame);
467 476
468 case SIGCHLD: 477 case SIGCHLD:
469 while (1) 478 while (1)
470 { 479 {
471 if ((pid = waitpid (-1, &status, WNOHANG)) < 0) 480 if ((pid = waitpid (-1, &status, WNOHANG)) < 0)
725 /* Validate that the binary rc_exists if we are starting */ 734 /* Validate that the binary rc_exists if we are starting */
726 if (exec && start) 735 if (exec && start)
727 { 736 {
728 char *tmp; 737 char *tmp;
729 if (ch_root) 738 if (ch_root)
730 tmp = rc_strcatpaths (ch_root, exec, NULL); 739 tmp = rc_strcatpaths (ch_root, exec, (char *) NULL);
731 else 740 else
732 tmp = exec; 741 tmp = exec;
733 if (! rc_is_file (tmp)) 742 if (! rc_is_file (tmp))
734 { 743 {
735 eerror ("%s: %s does not exist", progname, tmp); 744 eerror ("%s: %s does not exist", progname, tmp);

Legend:
Removed from v.2547  
changed lines
  Added in v.2563

  ViewVC Help
Powered by ViewVC 1.1.20