osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ggsn/+/36840?usp=email )
Change subject: ggsn/ggsn_vty: create state-dir ......................................................................
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(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/40/36840/1
diff --git a/ggsn/ggsn_vty.c b/ggsn/ggsn_vty.c index 7414b6a..7d4202b 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> @@ -223,6 +225,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;