Skip to content

Commit

Permalink
Squashfs: fix f_pos check in get_dir_index_using_offset
Browse files Browse the repository at this point in the history
One off error in the f_pos check.  If f_pos is 3 or less don't
bother reading the index because we're at the start of the
directory, and we obviously already know where that is on disk.

This eliminates an unnecessary read.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
  • Loading branch information
Phillip Lougher committed Mar 10, 2012
1 parent 47f4396 commit 2158d3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/squashfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static int get_dir_index_using_offset(struct super_block *sb,
* is offset by 3 because we invent "." and ".." entries which are
* not actually stored in the directory.
*/
if (f_pos < 3)
if (f_pos <= 3)
return f_pos;
f_pos -= 3;

Expand Down

0 comments on commit 2158d3f

Please sign in to comment.