OSDN Git Service

Remove unnecessary TEMP_FAILURE_RETRY.
authorVladimir Marko <vmarko@google.com>
Tue, 5 Apr 2016 13:19:08 +0000 (14:19 +0100)
committerVladimir Marko <vmarko@google.com>
Tue, 5 Apr 2016 13:19:08 +0000 (14:19 +0100)
unlink, rmdir, rename and closedir do not generate EINTR.

Change-Id: Ia5daab3e19f7373d7c27cdb6a800351c86b5a4e5

runtime/gc/space/image_space_fs.h
runtime/oat_file_assistant.cc

index 5237466..eac52f7 100644 (file)
@@ -62,7 +62,7 @@ static void DeleteDirectoryContents(const std::string& dir, bool recurse) {
         if (recurse) {
           DeleteDirectoryContents(file, recurse);
           // Try to rmdir the directory.
-          if (TEMP_FAILURE_RETRY(rmdir(file.c_str())) != 0) {
+          if (rmdir(file.c_str()) != 0) {
             PLOG(ERROR) << "Unable to rmdir " << file;
           }
         }
@@ -71,12 +71,12 @@ static void DeleteDirectoryContents(const std::string& dir, bool recurse) {
       }
     } else {
       // Try to unlink the file.
-      if (TEMP_FAILURE_RETRY(unlink(file.c_str())) != 0) {
+      if (unlink(file.c_str()) != 0) {
         PLOG(ERROR) << "Unable to unlink " << file;
       }
     }
   }
-  CHECK_EQ(0, TEMP_FAILURE_RETRY(closedir(c_dir))) << "Unable to close directory.";
+  CHECK_EQ(0, closedir(c_dir)) << "Unable to close directory.";
 }
 
 static bool HasContent(const char* dir) {
@@ -95,10 +95,10 @@ static bool HasContent(const char* dir) {
       continue;
     }
     // Something here.
-    CHECK_EQ(0, TEMP_FAILURE_RETRY(closedir(c_dir))) << "Unable to close directory.";
+    CHECK_EQ(0, closedir(c_dir)) << "Unable to close directory.";
     return true;
   }
-  CHECK_EQ(0, TEMP_FAILURE_RETRY(closedir(c_dir))) << "Unable to close directory.";
+  CHECK_EQ(0, closedir(c_dir)) << "Unable to close directory.";
   return false;
 }
 
@@ -115,7 +115,7 @@ static void DeleteEmptyDirectoriesUpTo(const std::string& dir, const char* stop_
     }
   }
   if (OS::DirectoryExists(dir.c_str())) {
-    if (TEMP_FAILURE_RETRY(rmdir(dir.c_str())) != 0) {
+    if (rmdir(dir.c_str()) != 0) {
       PLOG(ERROR) << "Unable to rmdir " << dir;
       return;
     }
@@ -136,7 +136,7 @@ static void MoveOTAArtifacts(const char* src, const char* trg) {
     return;
   }
 
-  if (TEMP_FAILURE_RETRY(rename(src, trg)) != 0) {
+  if (rename(src, trg) != 0) {
     PLOG(ERROR) << "Could not rename OTA cache " << src << " to target " << trg;
   }
 }
index ce892f3..32e95e7 100644 (file)
@@ -77,7 +77,7 @@ OatFileAssistant::OatFileAssistant(const char* dex_location,
 OatFileAssistant::~OatFileAssistant() {
   // Clean up the lock file.
   if (flock_.HasFile()) {
-    TEMP_FAILURE_RETRY(unlink(flock_.GetFile()->GetPath().c_str()));
+    unlink(flock_.GetFile()->GetPath().c_str());
   }
 }
 
@@ -109,7 +109,7 @@ bool OatFileAssistant::Lock(std::string* error_msg) {
   std::string lock_file_name = *OatFileName() + ".flock";
 
   if (!flock_.Init(lock_file_name.c_str(), error_msg)) {
-    TEMP_FAILURE_RETRY(unlink(lock_file_name.c_str()));
+    unlink(lock_file_name.c_str());
     return false;
   }
   return true;
@@ -613,7 +613,7 @@ OatFileAssistant::RelocateOatFile(const std::string* input_file, std::string* er
   if (!Exec(argv, error_msg)) {
     // Manually delete the file. This ensures there is no garbage left over if
     // the process unexpectedly died.
-    TEMP_FAILURE_RETRY(unlink(oat_file_name.c_str()));
+    unlink(oat_file_name.c_str());
     return kUpdateFailed;
   }
 
@@ -673,13 +673,13 @@ OatFileAssistant::GenerateOatFile(CompilerFilter::Filter target, std::string* er
     // Manually delete the file. This ensures there is no garbage left over if
     // the process unexpectedly died.
     oat_file->Erase();
-    TEMP_FAILURE_RETRY(unlink(oat_file_name.c_str()));
+    unlink(oat_file_name.c_str());
     return kUpdateFailed;
   }
 
   if (oat_file->FlushCloseOrErase() != 0) {
     *error_msg = "Unable to close oat file " + oat_file_name;
-    TEMP_FAILURE_RETRY(unlink(oat_file_name.c_str()));
+    unlink(oat_file_name.c_str());
     return kUpdateFailed;
   }