osmith submitted this change.
ggsn/ggsn_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: I91349fb284336a9de6af41475f1b824eb0e021b0
---
M ggsn/ggsn_vty.c
1 file changed, 19 insertions(+), 0 deletions(-)
diff --git a/ggsn/ggsn_vty.c b/ggsn/ggsn_vty.c
index f70daf1..da67591 100644
--- a/ggsn/ggsn_vty.c
+++ b/ggsn/ggsn_vty.c
@@ -22,6 +22,8 @@
#include <inttypes.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/utils.h>
@@ -224,6 +226,11 @@
{
struct ggsn_ctx *ggsn = (struct ggsn_ctx *) vty->index;
+ 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(ggsn, &ggsn->cfg.state_dir, argv[0]);
return CMD_SUCCESS;
To view, visit change 36840. To unsubscribe, or for help writing mail filters, visit settings.