osmith submitted this change.
sgsn/sgsn_vty: create state-dir
Prepare to change the state-dir in the default config in a follow-up
commit. Create the directory if it does not exist.
Change-Id: I8db4898cdaa2fcbd6bbf7c543764b9cdf828de83
---
M src/sgsn/sgsn_vty.c
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/sgsn/sgsn_vty.c b/src/sgsn/sgsn_vty.c
index 6837e71..6ca5a7d 100644
--- a/src/sgsn/sgsn_vty.c
+++ b/src/sgsn/sgsn_vty.c
@@ -24,6 +24,8 @@
#include <arpa/inet.h>
#include <time.h>
#include <inttypes.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/utils.h>
@@ -404,6 +406,11 @@
"Set the directory for the GTP State file\n"
"Local Directory\n")
{
+ if (mkdir(argv[0], 0755) == -1 && errno != EEXIST) {
+ vty_out(vty, "%% Failed to create state-dir: %s%s", argv[0], VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
osmo_talloc_replace_string(sgsn, &sgsn->cfg.gtp_statedir, argv[0]);
return CMD_SUCCESS;
To view, visit change 36844. To unsubscribe, or for help writing mail filters, visit settings.