Browse Source

HADOOP-1358. Fix a potential bug when DFSClient calls skipBytes. Contributed by Hairong.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@538318 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 năm trước cách đây
mục cha
commit
b16ef753d1
2 tập tin đã thay đổi với 8 bổ sung4 xóa
  1. 3 0
      CHANGES.txt
  2. 5 4
      src/java/org/apache/hadoop/dfs/DFSClient.java

+ 3 - 0
CHANGES.txt

@@ -401,6 +401,9 @@ Branch 0.13 (unreleased changes)
 115. HADOOP-1354.  Fix a potential NullPointerException in FsShell.
      (Hairong Kuang via cutting)
 
+116. HADOOP-1358.  Fix a potential bug when DFSClient calls skipBytes.
+     (Hairong Kuang via cutting)
+
 
 Release 0.12.3 - 2007-04-06
 

+ 5 - 4
src/java/org/apache/hadoop/dfs/DFSClient.java

@@ -926,10 +926,11 @@ class DFSClient implements FSConstants {
         //
         int diff = (int)(targetPos - pos);
         if (diff <= TCP_WINDOW_SIZE) {
-          blockStream.skipBytes(diff);
-          pos += diff;
-          assert(pos == targetPos);
-          done = true;
+          int adiff = blockStream.skipBytes(diff);
+          pos += adiff;
+          if (pos == targetPos) {
+            done = true;
+          }
         }
       }
       if (!done) {