From 39d801473ba06f820c8706b3d6bf268499bb5ecf Mon Sep 17 00:00:00 2001 From: Pierre-Hugues Husson Date: Sun, 24 Apr 2022 08:03:48 -0400 Subject: [PATCH] [OTA] Retry stat-ing mapper device See https://github.com/phhusson/treble_experimentations/issues/2289 --- ota/phh-ota.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ota/phh-ota.cpp b/ota/phh-ota.cpp index d0cc16e..e90106a 100644 --- a/ota/phh-ota.cpp +++ b/ota/phh-ota.cpp @@ -67,7 +67,10 @@ int main(int argc, char **argv) { printf("%s\n", blockDev.c_str()); struct stat sb; - stat(blockDev.c_str(), &sb); + for(int i=0; i<10; i++) { + if(!stat(blockDev.c_str(), &sb)) break; + sleep(1); + } if(!S_ISBLK(sb.st_mode)) { fprintf(stderr, "blockDev wasn't block dev\n");