diff options
author | 2016-10-12 21:09:42 +0000 | |
---|---|---|
committer | 2016-10-12 21:09:42 +0000 | |
commit | 3970c44547d343bef89859f4c45b299a4e1a0b8b (patch) | |
tree | 4e577bfba5916337808174bda6a2f17ffc80ae77 /libs/androidfw/AssetManager.cpp | |
parent | d3725ee017d998b545cbb6199bd070c53e13bc2a (diff) | |
parent | dce79f10ba59e5c6f8a5a38ccb5075c5907d6d46 (diff) |
RRO: Synchronize access to overlays.list am: 0fbb608110
am: dce79f10ba
Change-Id: Idc121ffe64f1bc7b5bdcb1a800305165f27f1c0a
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 043989874bc8..4c1c1b935980 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> @@ -768,6 +771,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: @@ -798,6 +807,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); } |