fix(platform): keep the single-instance lock fd out of child processes
On Linux and macOS the lock file was opened without O_CLOEXEC, so xdg-open and the browser it starts, dragonxd and xmrig all inherited it. A clean exit unlocks explicitly, but after a crash or kill the lock stayed held for as long as any of those children ran (indefinitely with "keep daemon running"), and the wallet refused to relaunch. The fd is now opened O_CLOEXEC; nothing else changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user