Skip to contentSkip to conversation

Fix ext2_readdir()

PATCH New Jan Blunck 1 participant 1 message Jul 26, 2004 ext2 file system

lore
Share & tools
lore

Jan Blunck

author
#0 lore raw

PATCH 1/1 Fix ext2_readdir()

I noticed that ext2_readdir() is ignoring the set error return values and always returns 0.

fs/ext2/dir.c +6 -4
Index: testing-2.5/fs/ext2/dir.c
===================================================================
@@ -257,10 +257,10 @@
 	unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
 	unsigned char *types = NULL;
 	int need_revalidate = (filp->f_version != inode->i_version);
-	int ret = 0;
+	int ret;
 
 	if (pos > inode->i_size - EXT2_DIR_REC_LEN(1))
-		goto done;
+		goto success;
 
 	if (EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_FILETYPE))
 		types = ext2_filetype_table;
@@ -300,17 +300,19 @@
 						le32_to_cpu(de->inode), d_type);
 				if (over) {
 					ext2_put_page(page);
-					goto done;
+					goto success;
 				}
 			}
 		}
 		ext2_put_page(page);
 	}
 
+success:
+	ret = 0;
 done:
 	filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset;
 	filp->f_version = inode->i_version;
-	return 0;
+	return ret;
 }
 
 /*