ffserver: make statement block unconditional by exiting early

Signed-off-by: 's avatarReynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
parent 36a617c1
...@@ -3771,24 +3771,24 @@ static void compute_bandwidth(void) ...@@ -3771,24 +3771,24 @@ static void compute_bandwidth(void)
static void handle_child_exit(int sig) static void handle_child_exit(int sig)
{ {
pid_t pid; pid_t pid;
int status; int status, uptime;
while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
FFServerStream *feed; FFServerStream *feed;
for (feed = config.first_feed; feed; feed = feed->next) { for (feed = config.first_feed; feed; feed = feed->next) {
if (feed->pid == pid) { if (feed->pid != pid)
int uptime = time(0) - feed->pid_start; continue;
feed->pid = 0; uptime = time(0) - feed->pid_start;
fprintf(stderr, feed->pid = 0;
"%s: Pid %d exited with status %d after %d seconds\n", fprintf(stderr,
feed->filename, pid, status, uptime); "%s: Pid %d exited with status %d after %d seconds\n",
feed->filename, pid, status, uptime);
if (uptime < 30) if (uptime < 30)
/* Turn off any more restarts */ /* Turn off any more restarts */
ffserver_free_child_args(&feed->child_argv); ffserver_free_child_args(&feed->child_argv);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment