From 73f20a48c0198d43de12de77d4080fc7ef29e5fd Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 1 Dec 2022 02:04:02 +0900 Subject: [PATCH] fixed a bug in untar's process_content() function --- lib/tar.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/tar.c b/lib/tar.c index 0304da6..f0a5c7e 100644 --- a/lib/tar.c +++ b/lib/tar.c @@ -337,6 +337,7 @@ static int process_content (hio_tar_t* tar) HIO_ASSERT (tar->hio, tar->blk.len == HIO_TAR_BLKSIZE); HIO_ASSERT (tar->hio, tar->hi.filesize > 0); + HIO_ASSERT (tar->hio, tar->hi.fp != HIO_NULL); //printf("process_content...\n"); @@ -349,11 +350,10 @@ static int process_content (hio_tar_t* tar) if (tar->hi.filesize <= 0) { /* end of file */ - if (tar->hi.fp) - { - fclose (tar->hi.fp); - tar->hi.fp = HIO_NULL; - } + fclose (tar->hi.fp); + tar->hi.fp = HIO_NULL; + + tar->state = HIO_TAR_STATE_START; } return 0;