10BC0 Draft archive_read_data_into_FILE by vadimkantorov · Pull Request #2504 · libarchive/libarchive · GitHub
[go: up one dir, main page]

Skip to content

Conversation

vadimkantorov
Copy link
@vadimkantorov vadimkantorov commented Feb 6, 2025

WIP for #2299

  • still no tests, docs
  • for now put the archive_read_data_into_FILE function in libarchive/archive_read_data_into_fd.c - to be moved into a new file
  • no integration in the build system
  • checks for now fail because this new function is unused and does not have prototype in the public API

Questions:

  • Should use fseeko instead of fseek? If not, how to handle seek offset not fitting into long?
  • Is the approach of trying seeking and then falling back to writing nulls okay?
    • For the archive_read_data_into_fd libarchive uses fstat to do the test, but for working with FILE stat might not be available, or fileno might not be supported (e.g. for fmemopen or open_memstream-produced FILE - this is my original usecase)
    • Should I instead still try retrieving fileno and if it's >= do the stat?
  • Can't we just allocate 16384 bytes on stack (and memzero them) instead of using the allocator/ calloc/free? Or even always have a zero-valued static byte array? (the same question for existing archive_read_data_into_fd)

Thanks!

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.

1 participant
0