#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <limits.h>
#include <osmocore/msgb.h>
#include <osmocore/talloc.h>
struct gsm322_plmn *plmn = &ms->plmn;
struct gsm322_cellsel *cs = &ms->cellsel;
FILE *fp;
- char filename[128];
+ char filename[PATH_MAX];
int i;
struct gsm322_ba_list *ba;
uint8_t buf[4];
cs->list[i].flags |= GSM322_CS_FLAG_SUPPORT;
/* read BA list */
- sprintf(filename, "/etc/osmocom/%s.ba", ms->name);
+ sprintf(filename, "%s/%s.ba", config_dir, ms->name);
fp = fopen(filename, "r");
if (fp) {
int rc;
struct llist_head *lh, *lh2;
struct msgb *msg;
FILE *fp;
- char filename[128];
+ char filename[PATH_MAX];
struct gsm322_ba_list *ba;
uint8_t buf[4];
int i;
}
/* store BA list */
- sprintf(filename, "/etc/osmocom/%s.ba", ms->name);
+ sprintf(filename, "%s/%s.ba", config_dir, ms->name);
fp = fopen(filename, "w");
if (fp) {
int rc;
}
return 0;
}
-
-
#include <fcntl.h>
#include <signal.h>
#include <time.h>
+#include <libgen.h>
struct log_target *stderr_target;
static uint32_t gsmtap_ip = 0;
unsigned short vty_port = 4247;
int debug_set = 0;
+char *config_dir = NULL;
int mobile_delete(struct osmocom_ms *ms, int force);
int mobile_signal_cb(unsigned int subsys, unsigned int signal,
if (config_file != NULL)
snprintf(config_file, len, "%s/%s", home, osmocomcfg);
}
+ /* save the config file directory name */
+ config_dir = talloc_strdup(l23_ctx, config_file);
+ config_dir = dirname(config_dir);
+
rc = l23_app_init(NULL, config_file, vty_port);
- talloc_free(config_file);
if (rc)
exit(rc);