aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-11-30 04:44:54 +0000
committerMatt Kraai <kraai@debian.org>2000-11-30 04:44:54 +0000
commitc119ab9e295df66f25d8922788f68afad5835d52 (patch)
tree2ced1a43b4d6b494ca961040ea6a352baaff39a7
parent8c725e624a6fa97175f48e0fc34b37403e3b8613 (diff)
downloadbusybox-w32-c119ab9e295df66f25d8922788f68afad5835d52.tar.gz
busybox-w32-c119ab9e295df66f25d8922788f68afad5835d52.tar.bz2
busybox-w32-c119ab9e295df66f25d8922788f68afad5835d52.zip
Note an error if we are unable to list/extract specified files.
-rw-r--r--archival/tar.c16
-rw-r--r--tar.c16
2 files changed, 28 insertions, 4 deletions
diff --git a/archival/tar.c b/archival/tar.c
index a845df166..826ab9665 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -144,6 +144,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
144extern int tar_main(int argc, char **argv) 144extern int tar_main(int argc, char **argv)
145{ 145{
146 char** excludeList=NULL; 146 char** excludeList=NULL;
147 char** extractList=NULL;
147#if defined BB_FEATURE_TAR_EXCLUDE 148#if defined BB_FEATURE_TAR_EXCLUDE
148 int excludeListSize=0; 149 int excludeListSize=0;
149#endif 150#endif
@@ -230,8 +231,10 @@ extern int tar_main(int argc, char **argv)
230#endif 231#endif
231 } 232 }
232 if (listFlag == TRUE || extractFlag == TRUE) { 233 if (listFlag == TRUE || extractFlag == TRUE) {
234 if (*argv)
235 extractList = argv;
233 exit(readTarFile(tarName, extractFlag, listFlag, tostdoutFlag, 236 exit(readTarFile(tarName, extractFlag, listFlag, tostdoutFlag,
234 verboseFlag, argv, excludeList)); 237 verboseFlag, extractList, excludeList));
235 } 238 }
236 239
237 flagError: 240 flagError:
@@ -569,7 +572,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
569 continue; 572 continue;
570 } 573 }
571#endif 574#endif
572 if (*extractList != NULL) { 575 if (extractList != NULL) {
573 int skipFlag = TRUE; 576 int skipFlag = TRUE;
574 for (tmpList = extractList; *tmpList != NULL; tmpList++) { 577 for (tmpList = extractList; *tmpList != NULL; tmpList++) {
575 if (strncmp( *tmpList, header.name, strlen(*tmpList))==0 || ( 578 if (strncmp( *tmpList, header.name, strlen(*tmpList))==0 || (
@@ -580,6 +583,9 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
580 * the extractFlag set to FALSE, so the junk in the tarball 583 * the extractFlag set to FALSE, so the junk in the tarball
581 * is properly skipped over */ 584 * is properly skipped over */
582 skipFlag = FALSE; 585 skipFlag = FALSE;
586 memmove(extractList+1, extractList,
587 sizeof(*extractList)*(tmpList-extractList));
588 extractList++;
583 break; 589 break;
584 } 590 }
585 } 591 }
@@ -712,6 +718,12 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
712 /* Stuff to do when we are done */ 718 /* Stuff to do when we are done */
713endgame: 719endgame:
714 close( tarFd); 720 close( tarFd);
721 if (extractList != NULL) {
722 for (; *extractList != NULL; extractList++) {
723 errorMsg("%s: Not found in archive\n", *extractList);
724 errorFlag = TRUE;
725 }
726 }
715 if ( *(header.name) == '\0' ) { 727 if ( *(header.name) == '\0' ) {
716 if (errorFlag==TRUE) 728 if (errorFlag==TRUE)
717 errorMsg( "Error exit delayed from previous errors\n"); 729 errorMsg( "Error exit delayed from previous errors\n");
diff --git a/tar.c b/tar.c
index a845df166..826ab9665 100644
--- a/tar.c
+++ b/tar.c
@@ -144,6 +144,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
144extern int tar_main(int argc, char **argv) 144extern int tar_main(int argc, char **argv)
145{ 145{
146 char** excludeList=NULL; 146 char** excludeList=NULL;
147 char** extractList=NULL;
147#if defined BB_FEATURE_TAR_EXCLUDE 148#if defined BB_FEATURE_TAR_EXCLUDE
148 int excludeListSize=0; 149 int excludeListSize=0;
149#endif 150#endif
@@ -230,8 +231,10 @@ extern int tar_main(int argc, char **argv)
230#endif 231#endif
231 } 232 }
232 if (listFlag == TRUE || extractFlag == TRUE) { 233 if (listFlag == TRUE || extractFlag == TRUE) {
234 if (*argv)
235 extractList = argv;
233 exit(readTarFile(tarName, extractFlag, listFlag, tostdoutFlag, 236 exit(readTarFile(tarName, extractFlag, listFlag, tostdoutFlag,
234 verboseFlag, argv, excludeList)); 237 verboseFlag, extractList, excludeList));
235 } 238 }
236 239
237 flagError: 240 flagError:
@@ -569,7 +572,7 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
569 continue; 572 continue;
570 } 573 }
571#endif 574#endif
572 if (*extractList != NULL) { 575 if (extractList != NULL) {
573 int skipFlag = TRUE; 576 int skipFlag = TRUE;
574 for (tmpList = extractList; *tmpList != NULL; tmpList++) { 577 for (tmpList = extractList; *tmpList != NULL; tmpList++) {
575 if (strncmp( *tmpList, header.name, strlen(*tmpList))==0 || ( 578 if (strncmp( *tmpList, header.name, strlen(*tmpList))==0 || (
@@ -580,6 +583,9 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
580 * the extractFlag set to FALSE, so the junk in the tarball 583 * the extractFlag set to FALSE, so the junk in the tarball
581 * is properly skipped over */ 584 * is properly skipped over */
582 skipFlag = FALSE; 585 skipFlag = FALSE;
586 memmove(extractList+1, extractList,
587 sizeof(*extractList)*(tmpList-extractList));
588 extractList++;
583 break; 589 break;
584 } 590 }
585 } 591 }
@@ -712,6 +718,12 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
712 /* Stuff to do when we are done */ 718 /* Stuff to do when we are done */
713endgame: 719endgame:
714 close( tarFd); 720 close( tarFd);
721 if (extractList != NULL) {
722 for (; *extractList != NULL; extractList++) {
723 errorMsg("%s: Not found in archive\n", *extractList);
724 errorFlag = TRUE;
725 }
726 }
715 if ( *(header.name) == '\0' ) { 727 if ( *(header.name) == '\0' ) {
716 if (errorFlag==TRUE) 728 if (errorFlag==TRUE)
717 errorMsg( "Error exit delayed from previous errors\n"); 729 errorMsg( "Error exit delayed from previous errors\n");