summaryrefslogtreecommitdiffstats
path: root/rbutil
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-11-26 14:46:26 +0000
committerAidan MacDonald <amachronic@protonmail.com>2021-11-27 13:13:39 +0000
commite4d8431211eef3236a0030b49ed307ce6c048f6c (patch)
tree7125ad78575aaa49d6127b6b4bd812ee9e54bae0 /rbutil
parentc1709e3194855b93ffd6f68eaa750c6704b3e52f (diff)
downloadrockbox-e4d8431211eef3236a0030b49ed307ce6c048f6c.tar.gz
rockbox-e4d8431211eef3236a0030b49ed307ce6c048f6c.zip
Update microtar users to new library API
Change-Id: I8e74efb53b8a8c9a4d69b2a20024434e2868e4e0
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/jztool/src/x1000.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/rbutil/jztool/src/x1000.c b/rbutil/jztool/src/x1000.c
index aacad0ef01..f59727a2ca 100644
--- a/rbutil/jztool/src/x1000.c
+++ b/rbutil/jztool/src/x1000.c
@@ -21,7 +21,7 @@
#include "jztool.h"
#include "jztool_private.h"
-#include "microtar.h"
+#include "microtar-stdio.h"
#include <stdbool.h>
#include <string.h>
@@ -52,21 +52,22 @@ static int get_file(jz_context* jz, mtar_t* tar, const char* file,
bool decompress, jz_buffer** buf)
{
jz_buffer* buffer = NULL;
- mtar_header_t h;
+ const mtar_header_t* h;
int rc;
- rc = mtar_find(tar, file, &h);
+ rc = mtar_find(tar, file);
if(rc != MTAR_ESUCCESS) {
jz_log(jz, JZ_LOG_ERROR, "can't find %s in boot file, tar error %d", file, rc);
return JZ_ERR_BAD_FILE_FORMAT;
}
- buffer = jz_buffer_alloc(h.size, NULL);
+ h = mtar_get_header(tar);
+ buffer = jz_buffer_alloc(h->size, NULL);
if(!buffer)
return JZ_ERR_OUT_OF_MEMORY;
rc = mtar_read_data(tar, buffer->data, buffer->size);
- if(rc != MTAR_ESUCCESS) {
+ if(rc < 0 || (unsigned)rc != buffer->size) {
jz_buffer_free(buffer);
jz_log(jz, JZ_LOG_ERROR, "can't read %s in boot file, tar error %d", file, rc);
return JZ_ERR_BAD_FILE_FORMAT;
@@ -127,7 +128,7 @@ int jz_x1000_boot(jz_usbdev* dev, jz_device_type type, const char* filename)
sprintf(spl_filename, "spl.%s", dev_info->file_ext);
/* Now open the archive */
- rc = mtar_open(&tar, filename, "r");
+ rc = mtar_open(&tar, filename, "rb");
if(rc != MTAR_ESUCCESS) {
jz_log(dev->jz, JZ_LOG_ERROR, "cannot open file %s (tar error: %d)", filename, rc);
return JZ_ERR_OPEN_FILE;