Skip to content

Commit

Permalink
sgsn/sgsn_vty: create state-dir
Browse files Browse the repository at this point in the history
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
  • Loading branch information
osmith42 committed May 16, 2024
1 parent 0a6fe97 commit b3ce060
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/sgsn/sgsn_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit b3ce060

Please sign in to comment.