diff --git a/nonlib/Loggable.C b/nonlib/Loggable.C index b0edbe5..2bb6ebc 100644 --- a/nonlib/Loggable.C +++ b/nonlib/Loggable.C @@ -44,6 +44,7 @@ using std::max; +bool Loggable::_readonly = false; FILE *Loggable::_fp; unsigned int Loggable::_log_id = 0; int Loggable::_level = 0; @@ -116,8 +117,19 @@ Loggable::open ( const char *filename ) if ( ! ( fp = fopen( filename, "a+" ) ) ) { WARNING( "Could not open log file for writing!" ); - return false; + + if ( ! ( fp = fopen( filename, "r" ) ) ) + { + WARNING( "Could not open log file for reading!" ); + return false; + } + else + { + _readonly = true; + } } + + _readonly = false; load_unjournaled_state(); diff --git a/nonlib/Loggable.H b/nonlib/Loggable.H index e2f379c..25ed00a 100644 --- a/nonlib/Loggable.H +++ b/nonlib/Loggable.H @@ -70,6 +70,7 @@ class Loggable Log_Entry * unjournaled_state; }; + static bool _readonly; static FILE *_fp; static unsigned int _log_id; static int _level; @@ -141,6 +142,8 @@ private: static void clear_dirty ( void ) { signal_dirty( _dirty = 0 ); } public: + + static bool readonly ( void ) { return _readonly; } static bool replay ( const char *name );