Skip to content
This repository has been archived by the owner on Nov 21, 2020. It is now read-only.

Commit

Permalink
Fix tar reading
Browse files Browse the repository at this point in the history
  • Loading branch information
dd86k committed Mar 8, 2019
1 parent 8d3735f commit a686da5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/archives/tar.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#define TAR "ustar\000"
#define GNUTAR "GNUtar\00"
//TODO: 64-bit number versions with conditional compile option
#define TAR32L 0x61747375
#define TAR32H 0x00202072
#define GNUTAR32L 0x74554E47
#define GNUTAR32H 0x20007261
#define NAMSIZ 100
#define TUNMLEN 32
#define TGNMLEN 32
Expand Down
17 changes: 12 additions & 5 deletions src/etc.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,18 @@ void scan_etc() {
MOBI_OUT:

if (_ddseek(0x101, SEEK_SET)) goto _END; // Tar files
char btar[sizeof(TAR)];
_ddread(btar, sizeof(TAR));
if (strcmp(btar, TAR) == 0 || strcmp(btar, GNUTAR) == 0) {
scan_tar();
return;
//char btar[sizeof(TAR)];
//_ddread(btar, sizeof(TAR));
uint32_t btar32[2];
_ddread(btar32, 8);
//if (strcmp(btar, TAR) == 0 || strncmp(btar, GNUTAR, 8) == 0) {
switch (btar32[0]) {
case TAR32L: case GNUTAR32L:
switch (btar32[1]) {
case TAR32H: case GNUTAR32H:
scan_tar(); return;
}
break;
}

if (_ddseek(0x8001, SEEK_SET)) goto _END; // ISO files
Expand Down

0 comments on commit a686da5

Please # to comment.