diff --git a/src/util/single_instance.cpp b/src/util/single_instance.cpp index 418e52c..31bd6d1 100644 --- a/src/util/single_instance.cpp +++ b/src/util/single_instance.cpp @@ -68,7 +68,9 @@ bool SingleInstance::tryLock() #else // Linux/macOS: Use file lock (flock) - lock_fd_ = open(lock_path_.c_str(), O_CREAT | O_RDWR, 0666); + // O_CLOEXEC: children (xdg-open + the browser it starts, dragonxd, xmrig) must not inherit the lock; + // after a crash they'd keep the flock held and block relaunching the wallet. + lock_fd_ = open(lock_path_.c_str(), O_CREAT | O_RDWR | O_CLOEXEC, 0666); if (lock_fd_ < 0) { DEBUG_LOGF("Failed to open lock file %s: %s\n", lock_path_.c_str(), strerror(errno));