From cb3644e86cb95a390e356924f42abbcc5e968122 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 14 Oct 2015 13:08:20 +0200 Subject: [PATCH] record.cpp: resort flags for xml-file and ts-file; add O_CLOEXEC to ts-file Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/be2c0a44cdc737ff9797c48437752dd52de2b746 Author: vanhofen Date: 2015-10-14 (Wed, 14 Oct 2015) Origin message was: ------------------ - record.cpp: resort flags for xml-file and ts-file; add O_CLOEXEC to ts-file --- src/driver/record.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/driver/record.cpp b/src/driver/record.cpp index 7c65d4940..b19e20128 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -117,7 +117,7 @@ bool CRecordInstance::SaveXml() int fd; std::string xmlfile = std::string(filename) + ".xml"; - if ((fd = open(xmlfile.c_str(), O_SYNC | O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) >= 0) { + if ((fd = open(xmlfile.c_str(), O_CREAT | O_TRUNC | O_SYNC | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) >= 0) { std::string extMessage; cMovieInfo->encodeMovieInfoXml(&extMessage, recMovieInfo); write(fd, extMessage.c_str(), extMessage.size() /*strlen(info)*/); @@ -155,7 +155,7 @@ record_error_msg_t CRecordInstance::Start(CZapitChannel * channel) std::string tsfile = std::string(filename) + ".ts"; printf("%s: file %s vpid %x apid %x\n", __FUNCTION__, tsfile.c_str(), allpids.PIDs.vpid, apids[0]); - int fd = open(tsfile.c_str(), O_CREAT | O_RDWR | O_LARGEFILE | O_TRUNC , S_IRWXO | S_IRWXG | S_IRWXU); + int fd = open(tsfile.c_str(), O_CREAT | O_TRUNC | O_SYNC | O_RDWR | O_LARGEFILE | O_CLOEXEC, S_IRWXO | S_IRWXG | S_IRWXU); if(fd < 0) { perror(tsfile.c_str()); hintBox.hide();