Commit e334f70b authored by winckel's avatar winckel

Fixed an issue when USIM_DIR, NVRAM_DIR and PWDenvironement variable are not defined for NAS UE.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5041 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent e76b0568
...@@ -61,17 +61,20 @@ char* memory_get_path(const char* dirname, const char* filename) ...@@ -61,17 +61,20 @@ char* memory_get_path(const char* dirname, const char* filename)
/* Get non-volatile data directory */ /* Get non-volatile data directory */
const char* path = getenv(dirname); const char* path = getenv(dirname);
if (path == NULL) { if (path == NULL) {
path = getenv(DEFAULT_NAS_PATH); path = getenv(DEFAULT_NAS_PATH);
}
if (path == NULL) {
return NULL;
} }
/* Append non-volatile data file name */ /* Append non-volatile data file name */
size_t size = strlen(path) + strlen(filename) + 1; size_t size = strlen(path) + strlen(filename) + 1;
char* data_filename = (char*)malloc(size+1); char* data_filename = (char*)malloc(size+1);
if (data_filename != NULL) { if (data_filename != NULL) {
if (size != sprintf(data_filename, "%s/%s", path, filename)) { if (size != sprintf(data_filename, "%s/%s", path, filename)) {
free(data_filename); free(data_filename);
return NULL; return NULL;
} }
} }
return data_filename; return data_filename;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment