summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2016-10-12 20:55:53 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-10-12 20:55:55 +0000
commitbaac85ec1f1f94ee220b734680aba3127546ece9 (patch)
tree030d5fdd5103b00fcdfc971f54592d88b0fa3c82 /libs
parent269f76a7d221134ca8148dda6db76fddbc9dd950 (diff)
parent0fbb60811076e6fcfd576287b6e6a16ac1a69c44 (diff)
downloadandroid-frameworks-base-baac85ec1f1f94ee220b734680aba3127546ece9.tar.gz
android-frameworks-base-baac85ec1f1f94ee220b734680aba3127546ece9.tar.xz
Merge "RRO: Synchronize access to overlays.list" into nyc-mr1-dev
Diffstat (limited to 'libs')
-rw-r--r--libs/androidfw/AssetManager.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
index 8ea25d6..07044d0 100644
--- a/libs/androidfw/AssetManager.cpp
+++ b/libs/androidfw/AssetManager.cpp
@@ -35,6 +35,9 @@
#include <utils/threads.h>
#include <utils/Timers.h>
#include <utils/Trace.h>
+#ifndef _WIN32
+#include <sys/file.h>
+#endif
#include <assert.h>
#include <dirent.h>
@@ -767,6 +770,12 @@ void AssetManager::addSystemOverlays(const char* pathOverlaysList,
return;
}
+#ifndef _WIN32
+ if (TEMP_FAILURE_RETRY(flock(fileno(fin), LOCK_SH)) != 0) {
+ fclose(fin);
+ return;
+ }
+#endif
char buf[1024];
while (fgets(buf, sizeof(buf), fin)) {
// format of each line:
@@ -797,6 +806,10 @@ void AssetManager::addSystemOverlays(const char* pathOverlaysList,
const_cast<AssetManager*>(this)->mZipSet.addOverlay(targetPackagePath, oap);
}
}
+
+#ifndef _WIN32
+ TEMP_FAILURE_RETRY(flock(fileno(fin), LOCK_UN));
+#endif
fclose(fin);
}