summaryrefslogtreecommitdiff
path: root/orkbasecxx/BatchProcessing.cpp
diff options
context:
space:
mode:
authorGerald Begumisa <ben_g@users.sourceforge.net>2007-09-04 19:56:54 +0000
committerGerald Begumisa <ben_g@users.sourceforge.net>2007-09-04 19:56:54 +0000
commit13d24d7f97fe6e739c47388279c63b961a7b8bc3 (patch)
treefe88e699741858ae0459d5b43e1c7b2422cd7dc0 /orkbasecxx/BatchProcessing.cpp
parent01240e01f8e4e63cbbdfebfb8b566e61e454cc7a (diff)
Ownership and permissions for MCF files now set at creation time, ownership and permissions code moved to Utils.cpp/h
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@479 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkbasecxx/BatchProcessing.cpp')
-rw-r--r--orkbasecxx/BatchProcessing.cpp64
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();