Skip to content

Using lfs_dir_tell at the end of a directory succeds, but then lfs_dir_seek fails #785

@sosthene-nitrokey

Description

@sosthene-nitrokey

Behaviour

When iterating over a directory with lfs_dir_open and lfs_dir_read in a loop, if after calling lfs_dir_read on the last file, one calls lfs_dir_tell, the call success. However, calling lfs_dir_seek with the given value fails with -22 (invalid).

Expected behaviour

I'd expect this to succeed and only further calls to lfs_dir_read to fail. It would also be reasonable to have lfs_dir_tell fail too with a NOENT error..

Reproducer

The test_dirs doesn't iterate over all the files created in the directory, so this bug doesn't happen in the test suite. See #786 for an updated test suite that triggers the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions