Ticket #129: openrc-0.4.1-start-stop-daemon.patch

File openrc-0.4.1-start-stop-daemon.patch, 1.1 KB (added by vaeth@mathematik.uni-wuerzburg.de, 20 months ago)

Patch for start-stop-daemon.c to postpone parse_schedule() after option parsing

  • src/rc/start-stop-daemon.c

     
    658658        mode_t numask; 
    659659        char **margv; 
    660660        unsigned int start_wait = 0; 
     661        bool retry = false; 
     662        char *retry_opt; 
    661663 
    662664        TAILQ_INIT(&schedule); 
    663665#ifdef DEBUG_MEMORY 
     
    694696                        break; 
    695697 
    696698                case 'R':  /* --retry <schedule>|<timeout> */ 
    697                         parse_schedule(optarg, sig); 
     699                        retry = true; 
     700                        if(optarg) 
     701                                retry_opt = xstrdup(optarg); 
     702                        else 
     703                                retry_opt = NULL; 
    698704                        break; 
    699705 
    700706                case 'S':  /* --start */ 
     
    837843            sig != SIGKILL) 
    838844                oknodo = true; 
    839845 
     846        if (stop && !sig) 
     847                sig = SIGTERM; 
     848 
     849        if (retry) { 
     850                parse_schedule(retry_opt, sig); 
     851                if (retry_opt) 
     852                        free(retry_opt); 
     853        } 
     854 
    840855        if (!exec) 
    841856                exec = startas; 
    842857        else if (!name) 
     
    853868        else if (exec) 
    854869                *--argv = exec; 
    855870 
    856         if (stop || sig) { 
     871        if (sig) { 
    857872                if (!*argv && !pidfile && !name && !uid) 
    858873                        eerrorx("%s: --stop needs --exec, --pidfile," 
    859874                                " --name or --user", applet); 
     
    954969        } 
    955970        margv = nav ? nav : argv; 
    956971 
    957         if (stop || sig) { 
    958                 if (!sig) 
    959                         sig = SIGTERM; 
     972        if (sig) { 
    960973                if (!stop) 
    961974                        oknodo = true; 
    962975                if (!TAILQ_FIRST(&schedule)) {