Bug 1060419 - make nsProfileLock.cpp use Printf.h, r?froydnj
MozReview-Commit-ID: KHhwAQUbfxb
--- a/toolkit/profile/nsProfileLock.cpp
+++ b/toolkit/profile/nsProfileLock.cpp
@@ -21,18 +21,18 @@
#ifdef XP_UNIX
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
#include "prnetdb.h"
#include "prsystem.h"
-#include "prprf.h"
#include "prenv.h"
+#include "mozilla/Printf.h"
#endif
#if defined(MOZ_WIDGET_GONK) && !defined(MOZ_CRASHREPORTER)
#include <sys/syscall.h>
#endif
// **********************************************************************
// class nsProfileLock
@@ -348,18 +348,18 @@ nsresult nsProfileLock::LockWithSymlink(
char netdbbuf[PR_NETDB_BUF_SIZE];
PRHostEnt hostent;
status = PR_GetHostByName(hostname, netdbbuf, sizeof netdbbuf, &hostent);
if (status == PR_SUCCESS)
memcpy(&inaddr, hostent.h_addr, sizeof inaddr);
}
char *signature =
- PR_smprintf("%s:%s%lu", inet_ntoa(inaddr), aHaveFcntlLock ? "+" : "",
- (unsigned long)getpid());
+ mozilla::Smprintf("%s:%s%lu", inet_ntoa(inaddr), aHaveFcntlLock ? "+" : "",
+ (unsigned long)getpid());
const char *fileName = lockFilePath.get();
int symlink_rv, symlink_errno = 0, tries = 0;
// use ns4.x-compatible symlinks if the FS supports them
while ((symlink_rv = symlink(signature, fileName)) < 0)
{
symlink_errno = errno;
if (symlink_errno != EEXIST)
@@ -370,17 +370,17 @@ nsresult nsProfileLock::LockWithSymlink(
// Lock seems to be bogus: try to claim it. Give up after a large
// number of attempts (100 comes from the 4.x codebase).
(void) unlink(fileName);
if (++tries > 100)
break;
}
- PR_smprintf_free(signature);
+ mozilla::SmprintfFree(signature);
signature = nullptr;
if (symlink_rv == 0)
{
// We exclusively created the symlink: record its name for eventual
// unlock-via-unlink.
rv = NS_OK;
mPidLockFileName = strdup(fileName);