Skip to content

Instantly share code, notes, and snippets.

@jld
Last active August 26, 2015 20:56
Show Gist options
  • Select an option

  • Save jld/ffa0dd26b810adead77d to your computer and use it in GitHub Desktop.

Select an option

Save jld/ffa0dd26b810adead77d to your computer and use it in GitHub Desktop.
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
index ab063db..40a35ce 100644
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -4495,12 +4495,12 @@ XRE_InitCommandLine(int aArgc, char* aArgv[])
// get the canonical version of the binary's path
nsCOMPtr<nsIFile> binFile;
rv = XRE_GetBinaryPath(aArgv[0], getter_AddRefs(binFile));
- if (NS_FAILED(rv))
+ if (NS_WARN_IF(NS_FAILED(rv)))
return NS_ERROR_FAILURE;
nsAutoCString canonBinPath;
rv = binFile->GetNativePath(canonBinPath);
- if (NS_FAILED(rv))
+ if (NS_WARN_IF(NS_FAILED(rv)))
return NS_ERROR_FAILURE;
canonArgs[0] = strdup(canonBinPath.get());
diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp
index 8d85bba..a10031a 100644
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -434,7 +434,7 @@ XRE_InitChildProcess(int aArgc,
SetupErrorHandling(aArgv[0]);
#if defined(MOZ_CRASHREPORTER)
- if (aArgc < 1)
+ if (NS_WARN_IF(aArgc < 1))
return NS_ERROR_FAILURE;
const char* const crashReporterArg = aArgv[--aArgc];
@@ -524,7 +524,7 @@ XRE_InitChildProcess(int aArgc,
NotificationService notificationService;
nsresult rv = XRE_InitCommandLine(aArgc, aArgv);
- if (NS_FAILED(rv)) {
+ if (NS_WARN_IF(NS_FAILED(rv))) {
profiler_shutdown();
NS_LogTerm();
return NS_ERROR_FAILURE;
@@ -598,7 +598,7 @@ XRE_InitChildProcess(int aArgc,
NS_RUNTIMEABORT("Unknown main thread class");
}
- if (!process->Init()) {
+ if (NS_WARN_IF(!process->Init())) {
profiler_shutdown();
NS_LogTerm();
return NS_ERROR_FAILURE;
diff --git a/xpcom/build/BinaryPath.h b/xpcom/build/BinaryPath.h
index 374763c..7cc6444 100644
--- a/xpcom/build/BinaryPath.h
+++ b/xpcom/build/BinaryPath.h
@@ -117,8 +117,9 @@ private:
// PATH. Only do so if argv[0] looks like a path (contains a /).
// 2) manually walk through the PATH and look for ourself
// 3) give up
- if (strchr(aArgv0, '/') && realpath(aArgv0, aResult) &&
- stat(aResult, &fileStat) == 0) {
+ if (strchr(aArgv0, '/') &&
+ !NS_WARN_IF(!realpath(aArgv0, aResult)) &&
+ !NS_WARN_IF(stat(aResult, &fileStat) != 0)) {
return NS_OK;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment