Skip to content

main: report errors when calling ftell(3) fails #4012

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion main/entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -2325,8 +2325,13 @@


long t0 = 0;
if (truncation)
if (truncation) {
t0 = mio_tell (TagFile.mio);
if (t0 == -1)
error (FATAL|PERROR,

Check warning on line 2331 in main/entry.c

View check run for this annotation

Codecov / codecov/patch

main/entry.c#L2331

Added line #L2331 was not covered by tests
"failed to tell the file position of the tag file (t0)\n");
}


if (mio_setpos (TagFile.mio, p) == -1)
error (FATAL|PERROR,
Expand All @@ -2335,6 +2340,10 @@
if (truncation)
{
long t1 = mio_tell (TagFile.mio);
if (t1 == -1)
error (FATAL|PERROR,

Check warning on line 2344 in main/entry.c

View check run for this annotation

Codecov / codecov/patch

main/entry.c#L2344

Added line #L2344 was not covered by tests
"failed to tell the file position of the tag file (t0)\n");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mistake of t1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... I'm shame. Thank you very much.


if (!mio_try_resize (TagFile.mio, (size_t)t1))
error (FATAL|PERROR,
"failed to truncate the tag file %ld -> %ld\n", t0, t1);
Expand Down
Loading