File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,11 @@ void Shutdown()
188
188
pwalletMain->Flush (true );
189
189
#endif
190
190
#ifndef WIN32
191
- boost::filesystem::remove (GetPidFile ());
191
+ try {
192
+ boost::filesystem::remove (GetPidFile ());
193
+ } catch (const boost::filesystem::filesystem_error& e) {
194
+ LogPrintf (" %s: Unable to remove pidfile: %s\n " , __func__, e.what ());
195
+ }
192
196
#endif
193
197
UnregisterAllValidationInterfaces ();
194
198
#ifdef ENABLE_WALLET
@@ -863,9 +867,15 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
863
867
boost::filesystem::path pathLockFile = GetDataDir () / " .lock" ;
864
868
FILE* file = fopen (pathLockFile.string ().c_str (), " a" ); // empty lock file; created if it doesn't exist.
865
869
if (file) fclose (file);
866
- static boost::interprocess::file_lock lock (pathLockFile.string ().c_str ());
867
- if (!lock.try_lock ())
868
- return InitError (strprintf (_ (" Cannot obtain a lock on data directory %s. Bitcoin Core is probably already running." ), strDataDir));
870
+
871
+ try {
872
+ static boost::interprocess::file_lock lock (pathLockFile.string ().c_str ());
873
+ if (!lock.try_lock ())
874
+ return InitError (strprintf (_ (" Cannot obtain a lock on data directory %s. Bitcoin Core is probably already running." ), strDataDir));
875
+ } catch (const boost::interprocess::interprocess_exception& e) {
876
+ return InitError (strprintf (_ (" Cannot obtain a lock on data directory %s. Bitcoin Core is probably already running." ) + " %s." , strDataDir, e.what ()));
877
+ }
878
+
869
879
#ifndef WIN32
870
880
CreatePidFile (GetPidFile (), getpid ());
871
881
#endif
You can’t perform that action at this time.
0 commit comments