Path: blob/main/comms/aprsd/files/patch-src_utils.cpp
16461 views
--- src/utils.cpp.orig 2003-10-01 16:58:27 UTC1+++ src/utils.cpp2@@ -41,6 +41,7 @@ int CountDefault = 7; //Max of 7 instances of one34static RecursiveMutex pmtxLog;56+const string LOGPATH("/var/log/aprsd/");78int WriteLog(const string& sp, const string& LogFile)9{10@@ -50,11 +51,12 @@ int WriteLog(const string& sp, const string& LogFile)11static Lock locker(pmtxLog, false);1213locker.get();14+ string pLogFile = LOGPATH + LogFile;1516- ofstream ofs(LogFile.c_str(), ios::out | ios::app);17+ ofstream ofs(pLogFile.c_str(), ios::out | ios::app);1819if (!ofs)20- cerr << "File I/O Error: Unable to open/create file " << LogFile << endl;21+ cerr << "File I/O Error: Unable to open/create file " << pLogFile << endl;2223time(<ime); // Timestamp24ctime_r(<ime, szTime); // "threadsafe" ctime25@@ -91,8 +93,8 @@ int WriteLog(const char* pch, const char* LogFile)2627pthread_mutex_lock(pmtxLog);2829- char* pLogFile = new char[CONFPATH.length() + strlen(LogFile) +1];30- strcpy(pLogFile,CONFPATH.c_str());31+ char* pLogFile = new char[LOGPATH.length() + strlen(LogFile) +1];32+ strcpy(pLogFile,LOGPATH.c_str());33strcat(pLogFile, LogFile);3435f = fopen(pLogFile, "a");363738