aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-03-22 10:14:46 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-03-22 10:14:46 +0100
commitf63bf4d8f13c1707e6fb68f0ef722caa3cb8c4ba (patch)
tree52259d6d6f3dcbaf410d0a766e934a3b3d6e94cc
parente6678dcedb3bb8227fbd831adb6edf076b5eec51 (diff)
ipa-firmware: Add the entry first and then seek
The sub entry might not be a SDP file so it is best to add the read entry, add it to the list and then attempt to recursively parse this one.
-rw-r--r--openbsc/src/ipaccess/ipaccess-firmware.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/openbsc/src/ipaccess/ipaccess-firmware.c b/openbsc/src/ipaccess/ipaccess-firmware.c
index 8c7f08f26..5f16a7d58 100644
--- a/openbsc/src/ipaccess/ipaccess-firmware.c
+++ b/openbsc/src/ipaccess/ipaccess-firmware.c
@@ -115,6 +115,10 @@ int ipaccess_analyze_file(int fd, const unsigned int st_size, const unsigned int
return -1;
}
+ header_entry = talloc_zero(header, struct sdp_header_item);
+ header_entry->header_entry = entry;
+ llist_add(&header_entry->entry, &header->header_list);
+
/* now we need to find the SDP file... */
offset = ntohl(entry.start) + 4 + base_offset;
if (lseek(fd, offset, SEEK_SET) != offset) {
@@ -122,9 +126,6 @@ int ipaccess_analyze_file(int fd, const unsigned int st_size, const unsigned int
return -1;
}
- header_entry = talloc_zero(header, struct sdp_header_item);
- header_entry->header_entry = entry;
- llist_add(&header_entry->entry, &header->header_list);
ipaccess_analyze_file(fd, ntohl(entry.length), offset, list);
}