Skip to content

Commit 63aea50

Browse files
committed
Bug 1767421: Remove use of deprecated GetProcessInformation function. r=mstange
I'm going to assert that we no longer need to worry about someone running something prior to mozilla 1.3 and so the easiest way to remove this compiler warning is to just remove this check for the old-style locking entirely. Differential Revision: https://phabricator.services.mozilla.com/D145321
1 parent 0fbe6a7 commit 63aea50

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

toolkit/profile/nsProfileLock.cpp

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -453,48 +453,6 @@ nsresult nsProfileLock::Lock(nsIFile* aProfileDir,
453453
// assume we tried an NFS that does not support it. Now, try with symlink.
454454
rv = LockWithSymlink(lockFile, false);
455455
}
456-
457-
if (NS_SUCCEEDED(rv)) {
458-
// Check for the old-style lock used by pre-mozilla 1.3 builds.
459-
// Those builds used an earlier check to prevent the application
460-
// from launching if another instance was already running. Because
461-
// of that, we don't need to create an old-style lock as well.
462-
struct LockProcessInfo {
463-
ProcessSerialNumber psn;
464-
unsigned long launchDate;
465-
};
466-
467-
PRFileDesc* fd = nullptr;
468-
int32_t ioBytes;
469-
ProcessInfoRec processInfo;
470-
LockProcessInfo lockProcessInfo;
471-
472-
rv = lockFile->SetLeafName(OLD_LOCKFILE_NAME);
473-
if (NS_FAILED(rv)) return rv;
474-
rv = lockFile->OpenNSPRFileDesc(PR_RDONLY, 0, &fd);
475-
if (NS_SUCCEEDED(rv)) {
476-
ioBytes = PR_Read(fd, &lockProcessInfo, sizeof(LockProcessInfo));
477-
PR_Close(fd);
478-
479-
if (ioBytes == sizeof(LockProcessInfo)) {
480-
# ifdef __LP64__
481-
processInfo.processAppRef = nullptr;
482-
# else
483-
processInfo.processAppSpec = nullptr;
484-
# endif
485-
processInfo.processName = nullptr;
486-
processInfo.processInfoLength = sizeof(ProcessInfoRec);
487-
if (::GetProcessInformation(&lockProcessInfo.psn, &processInfo) ==
488-
noErr &&
489-
processInfo.processLaunchDate == lockProcessInfo.launchDate) {
490-
return NS_ERROR_FILE_ACCESS_DENIED;
491-
}
492-
} else {
493-
NS_WARNING("Could not read lock file - ignoring lock");
494-
}
495-
}
496-
rv = NS_OK; // Don't propagate error from OpenNSPRFileDesc.
497-
}
498456
#elif defined(XP_UNIX)
499457
// Get the old lockfile name
500458
nsCOMPtr<nsIFile> oldLockFile;

0 commit comments

Comments
 (0)