summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryalei wang <wylandrea@gmail.com>2018-12-27 02:28:16 +0000
committerGerrit Code Review <gerrit@fd.io>2018-12-27 02:28:16 +0000
commit642adb4b3f0be545c96a3cf929f2ede8a7be5b2d (patch)
tree48c10b5b26465615a07d41312469ecaa4f938799
parent15aaddae13faf2bdf7e5d6e18a5192aedbd27e9c (diff)
parent0ca6bd545292b94501b3d89c14be8eba9cf42d22 (diff)
Merge "Fix: change the search path"
-rw-r--r--stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c17
-rw-r--r--stacks/lwip_stack/src/nStackMain/main.c2
2 files changed, 17 insertions, 2 deletions
diff --git a/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c b/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c
index e2334ea..6e10c7a 100644
--- a/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c
+++ b/stacks/lwip_stack/lwip_src/ip_module/configuration_reader.c
@@ -361,7 +361,14 @@ get_network_json_data ()
tmp_config_path = realpath ("./network_data_tonStack.json", NULL);
if (!tmp_config_path)
{
- exit (1);
+ NSTCP_LOGINF ("Warning! It use the second search path ../configure");
+ tmp_config_path =
+ realpath ("../configure/network_data_tonStack.json", NULL);
+ }
+
+ if (!tmp_config_path)
+ {
+ return 1;
}
int fp = open (tmp_config_path, O_RDONLY);
@@ -454,7 +461,13 @@ get_ip_json_data ()
tmp_config_path = realpath ("./ip_data.json", NULL);
if (!tmp_config_path)
{
- exit (1);
+ NSTCP_LOGINF ("Warning! It use the second search path ../configure");
+ tmp_config_path = realpath ("../configure/ip_data.json", NULL);
+ }
+
+ if (!tmp_config_path)
+ {
+ return 1;
}
int fp = open (tmp_config_path, O_RDONLY);
diff --git a/stacks/lwip_stack/src/nStackMain/main.c b/stacks/lwip_stack/src/nStackMain/main.c
index ec36b75..3bc0a3b 100644
--- a/stacks/lwip_stack/src/nStackMain/main.c
+++ b/stacks/lwip_stack/src/nStackMain/main.c
@@ -399,11 +399,13 @@ main (int argc, char *argv[])
if (0 != get_network_json_data ())
{
NSFW_LOGINF ("get_network_json_data error");
+ return -1;
}
if (0 != get_ip_json_data ())
{
NSFW_LOGINF ("get_ip_json_data error");
+ return -1;
}
int ep_thread = 0;