laforge
/
openbts-osmo
Archived
1
0
Fork 0

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:
Thomas Tsou 2011-04-28 18:04:44 +01:00
parent 9de5527574
commit baffdf3e65
1 changed files with 4 additions and 0 deletions

View File

@ -170,6 +170,10 @@ Log::~Log()
// So just log.
gLogLock.lock();
mStream << std::endl;
if (gLoggingFile == NULL)
gLoggingFile = stdout;
fprintf(gLoggingFile, "%s", mStream.str().c_str());
fflush(gLoggingFile);
gLogLock.unlock();