int tag_fd = open(filename, O_RDONLY, 0600);
if (tag_fd == -1) {
perror("Could not open tag file");
int tag_fd = open(filename, O_RDONLY, 0600);
if (tag_fd == -1) {
perror("Could not open tag file");
*count = n_tag_records - offset;
if (offset > n_tag_records) {
fprintf(stderr, "Cannot access tag record beyond end\n");
*count = n_tag_records - offset;
if (offset > n_tag_records) {
fprintf(stderr, "Cannot access tag record beyond end\n");
goto tag_list_map_failed;
}
taglist = (struct tag *) mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, tag_fd, 0);
if (taglist == MAP_FAILED) {
perror("Could not mmap tag file");
goto tag_list_map_failed;
}
taglist = (struct tag *) mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, tag_fd, 0);
if (taglist == MAP_FAILED) {
perror("Could not mmap tag file");
goto tag_list_map_failed;
}
retlist = (struct tag *) malloc(sizeof(struct tag) * *count);
if (retlist == NULL) {
perror("Could not allocate memory for tag list");
goto tag_list_map_failed;
}
retlist = (struct tag *) malloc(sizeof(struct tag) * *count);
if (retlist == NULL) {
perror("Could not allocate memory for tag list");