diff options
| author | 2016-10-13 14:26:07 +0000 | |
|---|---|---|
| committer | 2016-10-13 14:26:07 +0000 | |
| commit | c68597e6719abe92c349b03372578fcd9bba7e6c (patch) | |
| tree | f136f773afec1a1eb99a7095e0212d03be0bdc6a /libs/androidfw/AssetManager.cpp | |
| parent | 4e7407a80ec46ec4c132af088f779d519b33041a (diff) | |
| parent | 1b9303e8f09af3081223df5ed8a90259d339ebc0 (diff) | |
Merge "RRO: Synchronize access to overlays.list" am: 78382db820
am: 1b9303e8f0
Change-Id: I3d6b143ffc5c08249e9a0be35c39b0e89b364c20
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 8ea25d60cc89..07044d0e9d61 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); } |