aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/ipaccess/ipaccess-config.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-03-22 09:50:56 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-03-22 09:50:56 +0100
commit6e79b54d7b7846c7b4de28eabbd08f6a181395af (patch)
treeba5f0d71b65913cb9f0b83f757c58de6af85ae27 /openbsc/src/ipaccess/ipaccess-config.c
parent622ab49311d7bc898772e96260f35373ef4f6496 (diff)
ipa-firmware: Warn/Exit when the required ids can not be found.
Diffstat (limited to 'openbsc/src/ipaccess/ipaccess-config.c')
-rw-r--r--openbsc/src/ipaccess/ipaccess-config.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c
index 037ed6000..ad20e67c1 100644
--- a/openbsc/src/ipaccess/ipaccess-config.c
+++ b/openbsc/src/ipaccess/ipaccess-config.c
@@ -427,7 +427,7 @@ static struct sw_load *create_swload(struct sdp_header *header)
return load;
}
-static void find_sw_load_params(const char *filename)
+static int find_sw_load_params(const char *filename)
{
struct stat stat;
struct sdp_header *header;
@@ -441,19 +441,19 @@ static void find_sw_load_params(const char *filename)
fd = open(filename, O_RDONLY);
if (!fd) {
perror("nada");
- return;
+ return -1;
}
/* verify the file */
if (fstat(fd, &stat) == -1) {
perror("Can not stat the file");
- return;
+ return -1;
}
ipaccess_analyze_file(fd, stat.st_size, 0, entry);
if (close(fd) != 0) {
perror("Close failed.\n");
- return;
+ return -1;
}
/* try to find what we are looking for */
@@ -465,7 +465,14 @@ static void find_sw_load_params(const char *filename)
}
}
+ if (!sw_load1 || !sw_load2) {
+ fprintf(stderr, "Did not find data.\n");
+ talloc_free(tall_firm_ctx);
+ return -1;
+ }
+
talloc_free(tall_firm_ctx);
+ return 0;
}
static void analyze_firmware(const char *filename)
@@ -615,7 +622,8 @@ int main(int argc, char **argv)
break;
case 'd':
software = strdup(optarg);
- find_sw_load_params(optarg);
+ if (find_sw_load_params(optarg) != 0)
+ exit(0);
break;
case 'f':
analyze_firmware(optarg);