uhd: fix seg fault at startup
On the E100, and possibly other systems, OpenBTS seg faults at startup. The cause is a null reference to the global logging file descriptor occuring due to an initializer order dependency, which is not guaranteed across compilation units. When this occurs, check for for null and set the output to stdout. Signed-off-by: Thomas Tsou <ttsou@vt.edu>
This commit is contained in:
parent
9de5527574
commit
baffdf3e65
|
@ -170,6 +170,10 @@ Log::~Log()
|
||||||
// So just log.
|
// So just log.
|
||||||
gLogLock.lock();
|
gLogLock.lock();
|
||||||
mStream << std::endl;
|
mStream << std::endl;
|
||||||
|
|
||||||
|
if (gLoggingFile == NULL)
|
||||||
|
gLoggingFile = stdout;
|
||||||
|
|
||||||
fprintf(gLoggingFile, "%s", mStream.str().c_str());
|
fprintf(gLoggingFile, "%s", mStream.str().c_str());
|
||||||
fflush(gLoggingFile);
|
fflush(gLoggingFile);
|
||||||
gLogLock.unlock();
|
gLogLock.unlock();
|
||||||
|
|
Reference in New Issue