winlin

quit child process when fork failed.

@@ -432,7 +432,7 @@ int SrsFFMPEG::start() @@ -432,7 +432,7 @@ int SrsFFMPEG::start()
432 if ((log_fd = ::open(log_file.c_str(), flags, mode)) < 0) { 432 if ((log_fd = ::open(log_file.c_str(), flags, mode)) < 0) {
433 ret = ERROR_ENCODER_OPEN; 433 ret = ERROR_ENCODER_OPEN;
434 srs_error("open encoder file %s failed. ret=%d", log_file.c_str(), ret); 434 srs_error("open encoder file %s failed. ret=%d", log_file.c_str(), ret);
435 - return ret; 435 + exit(ret);
436 } 436 }
437 437
438 // log basic info 438 // log basic info
@@ -450,12 +450,12 @@ int SrsFFMPEG::start() @@ -450,12 +450,12 @@ int SrsFFMPEG::start()
450 if (dup2(log_fd, STDOUT_FILENO) < 0) { 450 if (dup2(log_fd, STDOUT_FILENO) < 0) {
451 ret = ERROR_ENCODER_DUP2; 451 ret = ERROR_ENCODER_DUP2;
452 srs_error("dup2 encoder file failed. ret=%d", ret); 452 srs_error("dup2 encoder file failed. ret=%d", ret);
453 - return ret; 453 + exit(ret);
454 } 454 }
455 if (dup2(log_fd, STDERR_FILENO) < 0) { 455 if (dup2(log_fd, STDERR_FILENO) < 0) {
456 ret = ERROR_ENCODER_DUP2; 456 ret = ERROR_ENCODER_DUP2;
457 srs_error("dup2 encoder file failed. ret=%d", ret); 457 srs_error("dup2 encoder file failed. ret=%d", ret);
458 - return ret; 458 + exit(ret);
459 } 459 }
460 460
461 // close log fd 461 // close log fd