From 9d7826c6819d1ea68740b8ce02bd40f96b8d63cd Mon Sep 17 00:00:00 2001 From: winlin Date: Mon, 2 Nov 2015 11:44:22 +0800 Subject: [PATCH] quit child process when fork failed. --- trunk/src/app/srs_app_process.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/trunk/src/app/srs_app_process.cpp b/trunk/src/app/srs_app_process.cpp index c2b1f0332..00240eb07 100644 --- a/trunk/src/app/srs_app_process.cpp +++ b/trunk/src/app/srs_app_process.cpp @@ -137,13 +137,13 @@ int SrsProcess::start() if ((stdout_fd = ::open(stdout_file.c_str(), flags, mode)) < 0) { ret = ERROR_ENCODER_OPEN; fprintf(stderr, "open process stdout %s failed. ret=%d", stdout_file.c_str(), ret); - return ret; + exit(ret); } if (dup2(stdout_fd, STDOUT_FILENO) < 0) { ret = ERROR_ENCODER_DUP2; srs_error("dup2 process stdout failed. ret=%d", ret); - return ret; + exit(ret); } } @@ -156,13 +156,13 @@ int SrsProcess::start() if ((stderr_fd = ::open(stderr_file.c_str(), flags, mode)) < 0) { ret = ERROR_ENCODER_OPEN; fprintf(stderr, "open process stderr %s failed. ret=%d", stderr_file.c_str(), ret); - return ret; + exit(ret); } if (dup2(stderr_fd, STDERR_FILENO) < 0) { ret = ERROR_ENCODER_DUP2; srs_error("dup2 process stderr failed. ret=%d", ret); - return ret; + exit(ret); } }