Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file_iterator: return correct error when iterator is not a file #110

Merged
merged 1 commit into from
Sep 3, 2023

Conversation

Gottox
Copy link
Owner

@Gottox Gottox commented Sep 3, 2023

This change fixes the error code that was returned when a file iterator was initialized with a directory. Before this change, the iterator treated all file types as regular files and failed when they returned bogus file addresses. That works, but it is fragile and not the correct behavior.

This change adds a check to the iterator to ensure that it is initialized with a file and returns -SQSH_ERROR_NOT_A_FILE when it is not.

fixes #108.

This change fixes the error code that was returned when a file iterator
was initialized with a directory. Before this change, the iterator
treated all file types as regular files and failed when they returned
bogus file addresses. That works, but it is fragile and not the correct
behavior.

This change adds a check to the iterator to ensure that it is initialized
with a file and returns `-SQSH_ERROR_NOT_A_FILE` when it is not.
@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.05% 🎉

Comparison is base (91130e3) 59.17% compared to head (2008335) 59.23%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #110      +/-   ##
==========================================
+ Coverage   59.17%   59.23%   +0.05%     
==========================================
  Files          58       58              
  Lines        4728     4732       +4     
  Branches      707      708       +1     
==========================================
+ Hits         2798     2803       +5     
+ Misses       1522     1521       -1     
  Partials      408      408              
Files Changed Coverage Δ
lib/file/file_iterator.c 73.02% <100.00%> (+0.51%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Gottox Gottox merged commit fe3867d into main Sep 3, 2023
21 checks passed
@Gottox Gottox deleted the fix/error-when-iterator-is-not-file branch September 3, 2023 06:03
Gottox added a commit that referenced this pull request Sep 5, 2023
file_iterator: return correct error when iterator is not a file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error SQSH_ERROR_NOT_A_FILE is unused
2 participants