static void start_children(FFServerStream *feed)

{

    char *pathname;

    char *slash;

    int i;

    size_t cmd_length;



    if (no_launch)

        return;



    cmd_length = strlen(my_program_name);



   /**

    * FIXME: WIP Safeguard. Remove after clearing all harcoded

    * '1024' path lengths

    */

    if (cmd_length > PATH_LENGTH - 1) {

        http_log("Could not start children. Command line: '%s' exceeds "

                    "path length limit (%d)\n", my_program_name, PATH_LENGTH);

        return;

    }



    pathname = av_strdup (my_program_name);

    if (!pathname) {

        http_log("Could not allocate memory for children cmd line\n");

        return;

    }

   /* replace "ffserver" with "ffmpeg" in the path of current

    * program. Ignore user provided path */



    slash = strrchr(pathname, '/');

    if (!slash)

        slash = pathname;

    else

        slash++;

    strcpy(slash, "ffmpeg");



    for (; feed; feed = feed->next) {



        if (!feed->child_argv || feed->pid)

            continue;



        feed->pid_start = time(0);



        feed->pid = fork();

        if (feed->pid < 0) {

            http_log("Unable to create children: %s\n", strerror(errno));

            av_free (pathname);

            exit(EXIT_FAILURE);

        }



        if (feed->pid)

            continue;



        /* In child */



        http_log("Launch command line: ");

        http_log("%s ", pathname);



        for (i = 1; feed->child_argv[i] && feed->child_argv[i][0]; i++)

            http_log("%s ", feed->child_argv[i]);

        http_log("\n");



        for (i = 3; i < 256; i++)

            close(i);



        if (!config.debug) {

            if (!freopen("/dev/null", "r", stdin))

                http_log("failed to redirect STDIN to /dev/null\n;");

            if (!freopen("/dev/null", "w", stdout))

                http_log("failed to redirect STDOUT to /dev/null\n;");

            if (!freopen("/dev/null", "w", stderr))

                http_log("failed to redirect STDERR to /dev/null\n;");

        }



        signal(SIGPIPE, SIG_DFL);

        execvp(pathname, feed->child_argv);

        av_free (pathname);

        _exit(1);

    }

    av_free (pathname);

}

static void start_children(FFServerStream *feed)

{

    char *pathname;

    char *slash;

    int i;

    size_t cmd_length;



    if (no_launch)

        return;



    cmd_length = strlen(my_program_name);



   







    if (cmd_length > PATH_LENGTH - 1) {

        http_log("Could not start children. Command line: '%s' exceeds "

                    "path length limit (%d)\n", my_program_name, PATH_LENGTH);

        return;

    }



    pathname = av_strdup (my_program_name);

    if (!pathname) {

        http_log("Could not allocate memory for children cmd line\n");

        return;

    }

   





    slash = strrchr(pathname, '/');

    if (!slash)

        slash = pathname;

    else

        slash++;

    strcpy(slash, "ffmpeg");



    for (; feed; feed = feed->next) {



        if (!feed->child_argv || feed->pid)

            continue;



        feed->pid_start = time(0);



        feed->pid = fork();

        if (feed->pid < 0) {

            http_log("Unable to create children: %s\n", strerror(errno));

            av_free (pathname);

            exit(EXIT_FAILURE);

        }



        if (feed->pid)

            continue;



        



        http_log("Launch command line: ");

        http_log("%s ", pathname);



        for (i = 1; feed->child_argv[i] && feed->child_argv[i][0]; i++)

            http_log("%s ", feed->child_argv[i]);

        http_log("\n");



        for (i = 3; i < 256; i++)

            close(i);



        if (!config.debug) {

            if (!freopen("/dev/null", "r", stdin))

                http_log("failed to redirect STDIN to /dev/null\n;");

            if (!freopen("/dev/null", "w", stdout))

                http_log("failed to redirect STDOUT to /dev/null\n;");

            if (!freopen("/dev/null", "w", stderr))

                http_log("failed to redirect STDERR to /dev/null\n;");

        }



        signal(SIGPIPE, SIG_DFL);

        execvp(pathname, feed->child_argv);

        av_free (pathname);

        _exit(1);

    }

    av_free (pathname);

}

    pathname = av_strdup (my_program_name);     slash = strrchr(pathname, '/');     if (!slash)         slash = pathname;         slash++;     strcpy(slash, "ffmpeg");
static void FUNC_0(FFServerStream *VAR_0)

{

    char *VAR_1;

    char *VAR_2;

    int VAR_3;

    size_t cmd_length;



    if (no_launch)

        return;



    cmd_length = strlen(my_program_name);



   







    if (cmd_length > PATH_LENGTH - 1) {

        http_log("Could not start children. Command line: '%s' exceeds "

                    "path length limit (%d)\n", my_program_name, PATH_LENGTH);

        return;

    }



    VAR_1 = av_strdup (my_program_name);

    if (!VAR_1) {

        http_log("Could not allocate memory for children cmd line\n");

        return;

    }

   





    VAR_2 = strrchr(VAR_1, '/');

    if (!VAR_2)

        VAR_2 = VAR_1;

    else

        VAR_2++;

    strcpy(VAR_2, "ffmpeg");



    for (; VAR_0; VAR_0 = VAR_0->next) {



        if (!VAR_0->child_argv || VAR_0->pid)

            continue;



        VAR_0->pid_start = time(0);



        VAR_0->pid = fork();

        if (VAR_0->pid < 0) {

            http_log("Unable to create children: %s\n", strerror(errno));

            av_free (VAR_1);

            exit(EXIT_FAILURE);

        }



        if (VAR_0->pid)

            continue;



        



        http_log("Launch command line: ");

        http_log("%s ", VAR_1);



        for (VAR_3 = 1; VAR_0->child_argv[VAR_3] && VAR_0->child_argv[VAR_3][0]; VAR_3++)

            http_log("%s ", VAR_0->child_argv[VAR_3]);

        http_log("\n");



        for (VAR_3 = 3; VAR_3 < 256; VAR_3++)

            close(VAR_3);



        if (!config.debug) {

            if (!freopen("/dev/null", "r", stdin))

                http_log("failed to redirect STDIN to /dev/null\n;");

            if (!freopen("/dev/null", "w", stdout))

                http_log("failed to redirect STDOUT to /dev/null\n;");

            if (!freopen("/dev/null", "w", stderr))

                http_log("failed to redirect STDERR to /dev/null\n;");

        }



        signal(SIGPIPE, SIG_DFL);

        execvp(VAR_1, VAR_0->child_argv);

        av_free (VAR_1);

        _exit(1);

    }

    av_free (VAR_1);

}

static void FUNC_0(FFServerStream *VAR_0)
{ char *VAR_1; char *VAR_2; int VAR_3; size_t cmd_length; if (no_launch)
return; cmd_length = strlen(my_program_name); if (cmd_length > PATH_LENGTH - 1) { http_log("Could not start children. Command line: '%s' exceeds "
"path length limit (%d)\n", my_program_name, PATH_LENGTH); return; } VAR_1 = av_strdup (my_program_name); if (!VAR_1) { http_log("Could not allocate memory for children cmd line\n"); return; } VAR_2 = strrchr(VAR_1, '/'); if (!VAR_2)
VAR_2 = VAR_1; else
VAR_2++; strcpy(VAR_2, "ffmpeg"); for (; VAR_0; VAR_0 = VAR_0->next) { if (!VAR_0->child_argv || VAR_0->pid)
continue; VAR_0->pid_start = time(0); VAR_0->pid = fork(); if (VAR_0->pid < 0) { http_log("Unable to create children: %s\n", strerror(errno)); av_free (VAR_1); exit(EXIT_FAILURE); } if (VAR_0->pid)
continue; http_log("Launch command line: "); http_log("%s ", VAR_1); for (VAR_3 = 1; VAR_0->child_argv[VAR_3] && VAR_0->child_argv[VAR_3][0]; VAR_3++) http_log("%s ", VAR_0->child_argv[VAR_3]); http_log("\n"); for (VAR_3 = 3; VAR_3 < 256; VAR_3++) close(VAR_3); if (!config.debug) { if (!freopen("/dev/null", "r", stdin))
http_log("failed to redirect STDIN to /dev/null\n;"); if (!freopen("/dev/null", "w", stdout))
http_log("failed to redirect STDOUT to /dev/null\n;"); if (!freopen("/dev/null", "w", stderr))
http_log("failed to redirect STDERR to /dev/null\n;"); } signal(SIGPIPE, SIG_DFL); execvp(VAR_1, VAR_0->child_argv); av_free (VAR_1); _exit(1); } av_free (VAR_1); }