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