diff options
author | Martin Wallgren <martin.wallgren@sonymobile.com> | 2016-10-12 21:15:58 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-10-12 21:15:58 +0000 |
commit | 85dd1b859482d593fa724b7646f49819818c0e98 (patch) | |
tree | 384af77cf2f5f99cf666635a98e7bb8a52546744 /libs/androidfw/AssetManager.cpp | |
parent | 9bb551d83a1a9b83fff6034c394c02b02e4438cf (diff) | |
parent | 3970c44547d343bef89859f4c45b299a4e1a0b8b (diff) |
RRO: Synchronize access to overlays.list am: 0fbb608110 am: dce79f10ba
am: 3970c44547
Change-Id: I4c9eecad4c2d935a1f1840fed6d70685b82b7e65
Diffstat (limited to 'libs/androidfw/AssetManager.cpp')
-rw-r--r-- | libs/androidfw/AssetManager.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp index 796cb3633626..371bc9a25735 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> @@ -647,6 +650,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: @@ -677,6 +686,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); } |