bug 627767 - When starting up fennec, there are two fennec process, don't fork for lib cache when there are no libs to cache r=dougt a=blocking-fennec
authorBrad Lassey <blassey@mozilla.com>
Fri, 21 Jan 2011 13:28:44 -0500
changeset 61105 fe9298abe0696c164334f214c376721b84ed068d
parent 61104 4cfa1d632c93ead96d4afc0742f83ce68b54bf55
child 61106 60bd77aec10e561a260b70be6fb5f978fd8cb8cc
push idunknown
push userunknown
push dateunknown
reviewersdougt, blocking-fennec
bugs627767
milestone2.0b10pre
bug 627767 - When starting up fennec, there are two fennec process, don't fork for lib cache when there are no libs to cache r=dougt a=blocking-fennec
other-licenses/android/APKOpen.cpp
--- a/other-licenses/android/APKOpen.cpp
+++ b/other-licenses/android/APKOpen.cpp
@@ -690,17 +690,23 @@ Java_org_mozilla_gecko_GeckoAppShell_loa
   // XXX: java doesn't give us true UTF8, we should figure out something 
   // better to do here
   str = jenv->GetStringUTFChars(jApkName, NULL);
   if (str == NULL)
     return;
 
   loadLibs(str);
   jenv->ReleaseStringUTFChars(jApkName, str);
-  if (extractLibs && cache_mapping) {
+  bool haveLibsToWrite = false;
+  if (cache_mapping && extractLibs)
+    for (int i = 0; i < cache_count && !haveLibsToWrite; i++)
+      if (cache_mapping[i].buffer)
+        haveLibsToWrite = true;
+
+  if (haveLibsToWrite) {
     if (!fork()) {
       sleep(10);
       nice(10);
       int count = cache_count;
       while (count--) {
         struct lib_cache_info *info = &cache_mapping[count];
         if (!info->buffer)
           continue;