-#endif
-#ifdef CONFIG_FEATURE_TAR_GZIP
- if (get_header_ptr == get_header_tar_gz) {
- get_header_tar_gz(tar_handle);
- } else
-#endif
- while (get_header_tar(tar_handle) == EXIT_SUCCESS);
+#endif /* CONFIG_FEATURE_TAR_CREATE */
+ {
+ if ((tar_filename[0] == '-') && (tar_filename[1] == '\0')) {
+ tar_handle->src_fd = fileno(stdin);
+ tar_handle->seek = seek_by_char;
+ } else {
+ tar_handle->src_fd = bb_xopen(tar_filename, O_RDONLY);
+ }
+
+ if ((base_dir) && (chdir(base_dir))) {
+ bb_perror_msg_and_die("Couldnt chdir");
+ }
+
+ while (get_header_ptr(tar_handle) == EXIT_SUCCESS);
+
+ /* Ckeck that every file that should have been extracted was */
+ while (tar_handle->accept) {
+ if (find_list_entry(tar_handle->reject, tar_handle->accept->data) == NULL) {
+ if (find_list_entry(tar_handle->passed, tar_handle->accept->data) == NULL) {
+ bb_error_msg_and_die("%s: Not found in archive\n", tar_handle->accept->data);
+ }
+ }
+ tar_handle->accept = tar_handle->accept->link;
+ }
+ }