Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Unified Diff: runtime/bin/file_linux.cc

Issue 13654002: Change how File/Directory/Link .delete works. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/bin/file_linux.cc
diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc
index ceac63052bb2967dc5d10b1c465c74e7f7738ec1..99973cb79ed4381b7c90825645152cf29227018d 100644
--- a/runtime/bin/file_linux.cc
+++ b/runtime/bin/file_linux.cc
@@ -167,11 +167,21 @@ bool File::CreateLink(const char* name, const char* target) {
bool File::Delete(const char* name) {
- int status = TEMP_FAILURE_RETRY(remove(name));
- if (status == -1) {
+ if (File::GetType(name, false) == File::kIsLink) {
+ if (File::GetType(name, true) == File::kIsFile) {
+ return TEMP_FAILURE_RETRY(unlink(name)) == 0;
+ }
Søren Gjesse 2013/04/05 12:52:50 Set errno before returning false.
Anders Johnsen 2013/04/08 06:50:49 Done.
return false;
}
- return true;
+ return TEMP_FAILURE_RETRY(unlink(name)) == 0;
+}
+
+
+bool File::DeleteLink(const char* name) {
+ if (File::GetType(name, false) == kIsLink) {
+ return TEMP_FAILURE_RETRY(unlink(name)) == 0;
+ }
+ return false;
Søren Gjesse 2013/04/05 12:52:50 Set errno before returning false.
Anders Johnsen 2013/04/08 06:50:49 Done.
}

Powered by Google App Engine
This is Rietveld 408576698