]> git.sur5r.net Git - cc65/commitdiff
Fix two place where the directory offset wasn't tracked correctly.
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 3 Jun 2012 15:01:32 +0000 (15:01 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sun, 3 Jun 2012 15:01:32 +0000 (15:01 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@5675 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/cbm/readdir.c

index 0a20bdd06660504a296d40bcd2a79cd95964efd0..e7b91cc9113f820ace918deaea977a0d36dc60b8 100644 (file)
@@ -32,18 +32,21 @@ struct dirent* __fastcall__ readdir (register DIR* dir)
         /* errno already set */
         goto exitpoint;
     }
-    dir->off += 2;
 
     /* Read the number of blocks */
     if (!_dirread (dir, &entry.d_blocks, sizeof (entry.d_blocks))) {
         goto exitpoint;
     }
 
+    /* Adjust the directory offset */
+    dir->off += 4;
+
     /* Read the next file entry into the buffer */
-    for (count = 0, b = buffer; count < sizeof (buffer); ++count, ++b) {
+    for (count = 0, b = buffer; count < sizeof (buffer); ++b) {
         if (!_dirread1 (dir, b)) {
             goto exitpoint;
         }
+        ++count;
         if (*b == '\0') {
             break;
         }