Jelajahi Sumber

HADOOP-10805. ndfs hdfsDelete should check the return boolean (cmccabe)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HADOOP-10388@1609276 13f79535-47bb-0310-9956-ffa450edef68
Colin McCabe 11 tahun lalu
induk
melakukan
42ac67062e

+ 1 - 1
hadoop-native-core/src/main/native/jni/jnifs.c

@@ -1382,7 +1382,7 @@ static int jni_unlink(hdfsFS bfs, const char *path, int recursive)
         return -1;
         return -1;
     }
     }
     if (!jVal.z) {
     if (!jVal.z) {
-        errno = EIO;
+        errno = ENOENT;
         return -1;
         return -1;
     }
     }
     return 0;
     return 0;

+ 5 - 0
hadoop-native-core/src/main/native/ndfs/ndfs.c

@@ -593,6 +593,11 @@ static int ndfs_unlink(struct hdfs_internal *bfs,
     if (err) {
     if (err) {
         goto done;
         goto done;
     }
     }
+    if (resp->result == 0) {
+        err = hadoop_lerr_alloc(ENOENT, "ndfs_unlink(%s, recursive=%d): "
+                    "deletion failed on the server", uri, recursive);
+        goto done;
+    }
 
 
 done:
 done:
     free(path);
     free(path);