From b3ce06058c2eece633003fa37f24f304158a5280 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Thu, 16 May 2024 10:50:56 +0200 Subject: [PATCH] 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 --- src/sgsn/sgsn_vty.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/sgsn/sgsn_vty.c b/src/sgsn/sgsn_vty.c index 6837e7180..6ca5a7d25 100644 --- a/src/sgsn/sgsn_vty.c +++ b/src/sgsn/sgsn_vty.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include @@ -404,6 +406,11 @@ DEFUN(cfg_sgsn_state_dir, cfg_sgsn_state_dir_cmd, "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;