diff --git a/lib/shared_memory.cpp b/lib/shared_memory.cpp index bbf80f58..171c18b4 100644 --- a/lib/shared_memory.cpp +++ b/lib/shared_memory.cpp @@ -460,10 +460,6 @@ namespace IPC { return; } if (master) { - if (ftruncate(handle, 0) < 0) { - FAIL_MSG("truncate to zero for page %s failed: %s", name.c_str(), strerror(errno)); - return; - } if (ftruncate(handle, len) < 0) { FAIL_MSG("truncate to %lld for page %s failed: %s", len, name.c_str(), strerror(errno)); return; @@ -475,6 +471,10 @@ namespace IPC { return; } len = buffStats.st_size; + if (!len){ + mapped = 0; + return; + } } mapped = (char *)mmap(0, len, PROT_READ | PROT_WRITE, MAP_SHARED, handle, 0); if (mapped == MAP_FAILED) { diff --git a/src/output/output_rtmp.cpp b/src/output/output_rtmp.cpp index a5447079..3dc6ab5b 100644 --- a/src/output/output_rtmp.cpp +++ b/src/output/output_rtmp.cpp @@ -610,7 +610,6 @@ namespace Mist{ } if (amfData.getContentP(0)->StrValue() == "deleteStream"){ stop(); - onFinish(); return; } if ((amfData.getContentP(0)->StrValue() == "FCUnpublish") || (amfData.getContentP(0)->StrValue() == "releaseStream")){