| Index: runtime/bin/file_linux.cc
|
| diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc
|
| index ceac63052bb2967dc5d10b1c465c74e7f7738ec1..8126ff98179e78227958069d1f0c2b09ebc6b4c0 100644
|
| --- a/runtime/bin/file_linux.cc
|
| +++ b/runtime/bin/file_linux.cc
|
| @@ -167,11 +167,25 @@ 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) {
|
| - return false;
|
| + File::Type type = File::GetType(name, true);
|
| + if (type == kIsFile) {
|
| + return TEMP_FAILURE_RETRY(unlink(name)) == 0;
|
| + } else if (type == kIsDirectory) {
|
| + errno = EISDIR;
|
| + } else {
|
| + errno = ENOENT;
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +
|
| +bool File::DeleteLink(const char* name) {
|
| + File::Type type = File::GetType(name, false);
|
| + if (type == kIsLink) {
|
| + return TEMP_FAILURE_RETRY(unlink(name)) == 0;
|
| }
|
| - return true;
|
| + errno = EINVAL;
|
| + return false;
|
| }
|
|
|
|
|
|
|