diff options
Diffstat (limited to 'orkbasecxx/BatchProcessing.cpp')
-rw-r--r-- | orkbasecxx/BatchProcessing.cpp | 64 |
1 files changed, 4 insertions, 60 deletions
diff --git a/orkbasecxx/BatchProcessing.cpp b/orkbasecxx/BatchProcessing.cpp index 62d4d2d..dd082b0 100644 --- a/orkbasecxx/BatchProcessing.cpp +++ b/orkbasecxx/BatchProcessing.cpp @@ -318,16 +318,11 @@ void BatchProcessing::ThreadHandler(void *args) LOG4CXX_INFO(LOG.batchProcessingLog, logMsg); CStdString audioFilePath = CONFIG.m_audioOutputPath + "/" + audioTapeRef->GetPath(); - CStdString audioFileName, mcfFileName; + CStdString audioFileName; audioFileName = audioFilePath + "/" + audioTapeRef->GetIdentifier() + outFileRef->GetExtension(); - mcfFileName = audioFilePath + "/" + audioTapeRef->GetIdentifier() + fileRef->GetExtension(); - - //LOG4CXX_INFO(LOG.batchProcessingLog, "[" + trackingId + "] Th" + threadIdString + " audioFileName: " + audioFileName + " mcfFileName: " + mcfFileName); - -#ifndef WIN32 if(CONFIG.m_audioFilePermissions) { - if(chmod(audioFileName.c_str(), CONFIG.m_audioFilePermissions)) + if(FileSetPermissions(audioFileName, CONFIG.m_audioFilePermissions)) { CStdString logMsg; @@ -336,65 +331,14 @@ void BatchProcessing::ThreadHandler(void *args) } } - if(CONFIG.m_audioFilePermissions) { - if(chmod(mcfFileName.c_str(), CONFIG.m_audioFilePermissions)) - { - CStdString logMsg; - - logMsg.Format("Error setting permissions of %s to %o: %s", mcfFileName.c_str(), CONFIG.m_audioFilePermissions, strerror(errno)); - LOG4CXX_INFO(LOG.batchProcessingLog, "[" + trackingId + "] Th" + threadIdString + " " + logMsg); - } - } - if(CONFIG.m_audioFileGroup.size() && CONFIG.m_audioFileOwner.size()) { - struct group fileGroup, *fgP = NULL; - struct passwd fileUser, *fuP = NULL; - char infoGroupBuf[4096], infoUserBuf[4096]; - - memset(infoGroupBuf, 0, sizeof(infoGroupBuf)); - memset(infoUserBuf, 0, sizeof(infoUserBuf)); - memset(&fileGroup, 0, sizeof(fileGroup)); - memset(&fileUser, 0, sizeof(fileUser)); - - if(!getgrnam_r(CONFIG.m_audioFileGroup.c_str(), &fileGroup, infoGroupBuf, sizeof(infoGroupBuf), &fgP)) - { - if(!getpwnam_r(CONFIG.m_audioFileOwner.c_str(), &fileUser, infoUserBuf, sizeof(infoUserBuf), &fuP)) - { - - if(chown(audioFileName.c_str(), fileUser.pw_uid, fileGroup.gr_gid)) - { - CStdString logMsg; - - logMsg.Format("Error setting ownership and group of %s to %s:%s: %s", audioFileName.c_str(), CONFIG.m_audioFileOwner, CONFIG.m_audioFileGroup, strerror(errno)); - LOG4CXX_INFO(LOG.batchProcessingLog, "[" + trackingId + "] Th" + threadIdString + " " + logMsg); - } - - if(chown(mcfFileName.c_str(), fileUser.pw_uid, fileGroup.gr_gid)) - { - CStdString logMsg; - - logMsg.Format("Error setting ownership and group of %s to %s:%s: %s", mcfFileName.c_str(), CONFIG.m_audioFileOwner, CONFIG.m_audioFileGroup, strerror(errno)); - LOG4CXX_INFO(LOG.batchProcessingLog, "[" + trackingId + "] Th" + threadIdString + " " + logMsg); - } - } - else - { - CStdString logMsg; - - logMsg.Format("Failed to get user information for user %s, please check the AudioFileOwner parameter in config.xml", CONFIG.m_audioFileOwner); - LOG4CXX_INFO(LOG.batchProcessingLog, "[" + trackingId + "] Th" + threadIdString + " " + logMsg); - } - } - else + if(FileSetOwnership(audioFileName, CONFIG.m_audioFileOwner, CONFIG.m_audioFileGroup)) { - CStdString logMsg; - - logMsg.Format("Failed to get group information for group %s, please check the AudioFileGroup parameter in config.xml", CONFIG.m_audioFileGroup); + logMsg.Format("Error setting ownership and group of %s to %s:%s: %s", audioFileName.c_str(), CONFIG.m_audioFileOwner, CONFIG.m_audioFileGroup, strerror(errno)); LOG4CXX_INFO(LOG.batchProcessingLog, "[" + trackingId + "] Th" + threadIdString + " " + logMsg); } } -#endif if(CONFIG.m_deleteNativeFile) { fileRef->Delete(); |