osmith has submitted this change. (
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(-)
Approvals:
pespin: Looks good to me, but someone else must approve
osmith: Looks good to me, approved
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
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
https://gerrit.osmocom.org/c/osmo-ggsn/+/36840?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I91349fb284336a9de6af41475f1b824eb0e021b0
Gerrit-Change-Number: 36840
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged