Compare commits

..

No commits in common. "165352cdcaea1a8953bc5452224bb9f8f7b1bd73" and "56d43f98ac3dc6a4515dbe10c90c25ceb4c8ef46" have entirely different histories.

3 changed files with 1 additions and 13 deletions

View File

@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.8..3.22)
project(minitar LANGUAGES C VERSION 1.3.0)
option(MINITAR_IGNORE_UNSUPPORTED_TYPES "Skip past entries that have unsupported types instead of panicking" OFF)
set(SOURCES
src/tar.c
src/util.c
@ -11,10 +9,6 @@ set(SOURCES
add_library(minitar STATIC ${SOURCES})
if(MINITAR_IGNORE_UNSUPPORTED_TYPES)
target_compile_definitions(minitar PRIVATE MINITAR_IGNORE_UNSUPPORTED_TYPES)
endif()
target_include_directories(minitar PUBLIC ${CMAKE_CURRENT_LIST_DIR}) # for minitar.h
set_target_properties(minitar PROPERTIES OUTPUT_NAME mtar)

View File

@ -118,7 +118,7 @@ This enum lists all supported file types:
`MTAR_DIRECTORY`: Directories
Other file types supported in tar archives, such as block/character devices, FIFOs, or symlinks, are not supported and minitar will throw an error when encountering one of them. This behavior can be controlled by passing `-DMINITAR_IGNORE_UNSUPPORTED_TYPES=ON` to CMake when configuring, which will make minitar silently ignore such entries instead of panicking.
Other file types supported in tar archives, such as block/character devices, FIFOs, or symlinks, are not supported and minitar will throw an error when encountering one of them.
### minitar_entry_metadata
`struct minitar_entry_metadata`

View File

@ -1,6 +1,5 @@
#include "minitar.h"
#include "tar.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -94,7 +93,6 @@ static size_t minitar_align_down_to_block_size(size_t size)
static char* minitar_static_dup(const char* str, size_t size)
{
static char result[1024];
assert(size < 1024);
memcpy(result, str, size);
result[size] = 0;
return result;
@ -170,13 +168,9 @@ void minitar_parse_metadata_from_tar_header(const struct tar_header* hdr, struct
int minitar_validate_header(const struct tar_header* hdr)
{
#ifdef MINITAR_IGNORE_UNSUPPORTED_TYPES
if (hdr->typeflag != '\0' && hdr->typeflag != '0' && hdr->typeflag != '5') return 0;
#else
if (hdr->typeflag != '\0' && hdr->typeflag != '0' && hdr->typeflag != '1' && hdr->typeflag != '2' &&
hdr->typeflag != '3' && hdr->typeflag != '4' && hdr->typeflag != '5' && hdr->typeflag != '6')
return 0;
#endif
return !strncmp(hdr->magic, "ustar", 5);
}