Changeset 304:ad3c46016584 in freeDiameter for freeDiameter/config.c
- Timestamp:
- May 14, 2010, 5:26:53 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
freeDiameter/config.c
r258 r304 35 35 36 36 #include "fD.h" 37 #include <sys/stat.h> 37 38 38 39 /* Configuration management */ … … 51 52 52 53 fd_g_config->cnf_eyec = EYEC_CONFIG; 53 fd_g_config->cnf_file = DEFAULT_CONF_FILE;54 54 55 55 fd_g_config->cnf_timer_tc = 30; … … 145 145 extern FILE * fddin; 146 146 147 TRACE_DEBUG (FULL, "Parsing configuration file: %s", fd_g_config->cnf_file); 147 /* Attempt to find the configuration file */ 148 if (!fd_g_config->cnf_file) 149 fd_g_config->cnf_file = FD_DEFAULT_CONF_FILENAME; 148 150 149 151 fddin = fopen(fd_g_config->cnf_file, "r"); 152 if ((fddin == NULL) && (*fd_g_config->cnf_file != '/')) { 153 /* We got a relative path, attempt to add the default directory prefix */ 154 char * bkp = fd_g_config->cnf_file; 155 CHECK_MALLOC( fd_g_config->cnf_file = malloc(strlen(bkp) + strlen(DEFAULT_CONF_PATH) + 2) ); /* we will not free it, but not important */ 156 sprintf( fd_g_config->cnf_file, DEFAULT_CONF_PATH "/%s", bkp ); 157 fddin = fopen(fd_g_config->cnf_file, "r"); 158 } 150 159 if (fddin == NULL) { 151 160 int ret = errno; … … 155 164 156 165 /* call yacc parser */ 166 TRACE_DEBUG (FULL, "Parsing configuration file: %s", fd_g_config->cnf_file); 157 167 CHECK_FCT( fddparse(fd_g_config) ); 158 168
Note: See TracChangeset
for help on using the changeset viewer.