char *full_link_name = NULL;
char *buffer = NULL;
struct utimbuf t;
- int res;
/* prefix doesnt have to be a proper path it may prepend
tar_entry->name = concat_path_file(tar.formated.prefix, tar.formated.name);
}
+ if (strlen(tar_entry->name) > 100) {
+ tar_entry->name[100] = 0;
+ }
+
// tar_entry->name = xstrdup(tar.formated.name);
/*
char *output_buffer = NULL;
char *ared_file = NULL;
char ar_magic[8];
- int gunzip_pid;
+ int gunzip_pid = 0;
if (filename != NULL) {
file_list = xmalloc(sizeof(char *) * 2);
output_buffer = unarchive(uncompressed_stream, out_stream, get_header_tar, free_header_tar, extract_function, prefix, file_list);
}
seek_sub_file(deb_stream, ar_header->size);
+ free (ar_header->name);
+ free (ar_header);
}
gz_close(gunzip_pid);
fclose(deb_stream);
free(ared_file);
return(output_buffer);
} else if (strncmp(ar_magic, "\037\213", 2) == 0) {
- /* it's a gz file, let's assume it's an ipkg */
- int unzipped_ipkg_pid;
- FILE *unzipped_ipkg_stream;
+ /* it's a gz file, let's assume it's an opkg */
+ int unzipped_opkg_pid;
+ FILE *unzipped_opkg_stream;
file_header_t *tar_header;
archive_offset = 0;
fseek(deb_stream, 0, SEEK_SET);
- unzipped_ipkg_stream = gz_open(deb_stream, &unzipped_ipkg_pid);
+ unzipped_opkg_stream = gz_open(deb_stream, &unzipped_opkg_pid);
- /*fprintf(stderr, __FUNCTION__ ": processing ipkg %s -- ared_file=%s\n", package_filename, ared_file);*/
+ /*fprintf(stderr, __FUNCTION__ ": processing opkg %s -- ared_file=%s\n", package_filename, ared_file);*/
/* walk through outer tar file to find ared_file */
- while ((tar_header = get_header_tar(unzipped_ipkg_stream)) != NULL) {
+ while ((tar_header = get_header_tar(unzipped_opkg_stream)) != NULL) {
int name_offset = 0;
if (strncmp(tar_header->name, "./", 2) == 0)
name_offset = 2;
if (strcmp(ared_file, tar_header->name+name_offset) == 0) {
/* open a stream of decompressed data */
- uncompressed_stream = gz_open(unzipped_ipkg_stream, &gunzip_pid);
+ uncompressed_stream = gz_open(unzipped_opkg_stream, &gunzip_pid);
archive_offset = 0;
/*fprintf(stderr, __FUNCTION__ ":%d: here -- found file\n", __LINE__);*/
output_buffer = unarchive(uncompressed_stream,
fclose(uncompressed_stream);
break;
}
- seek_sub_file(unzipped_ipkg_stream, tar_header->size);
+ seek_sub_file(unzipped_opkg_stream, tar_header->size);
free_header_tar(tar_header);
}
- gz_close(unzipped_ipkg_pid);
- fclose(unzipped_ipkg_stream);
+ gz_close(unzipped_opkg_pid);
+ fclose(unzipped_opkg_stream);
fclose(deb_stream);
free(ared_file);
/*fprintf(stderr, __FUNCTION__ ":%d: done\n", __LINE__);*/