Changeset 947:cce5d4bace82 in freeDiameter for libfdcore/config.c
- Timestamp:
- Feb 13, 2013, 10:47:47 PM (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libfdcore/config.c
r946 r947 230 230 { 231 231 extern FILE * fddin; 232 c har * orig = NULL;232 const char * orig = NULL; 233 233 234 234 /* Attempt to find the configuration file */ … … 238 238 fddin = fopen(fd_g_config->cnf_file, "r"); 239 239 if ((fddin == NULL) && (*fd_g_config->cnf_file != '/')) { 240 char * new_cnf = NULL; 240 241 /* We got a relative path, attempt to add the default directory prefix */ 241 242 orig = fd_g_config->cnf_file; 242 CHECK_MALLOC( fd_g_config->cnf_file = malloc(strlen(orig) + strlen(DEFAULT_CONF_PATH) + 2) ); /* we will not free it, but not important */ 243 sprintf( fd_g_config->cnf_file, DEFAULT_CONF_PATH "/%s", orig ); 243 CHECK_MALLOC( new_cnf = malloc(strlen(orig) + strlen(DEFAULT_CONF_PATH) + 2) ); /* we will not free it, but not important */ 244 sprintf( new_cnf, DEFAULT_CONF_PATH "/%s", orig ); 245 fd_g_config->cnf_file = new_cnf; 244 246 fddin = fopen(fd_g_config->cnf_file, "r"); 245 247 } 246 248 if (fddin == NULL) { 247 249 int ret = errno; 248 if (orig) { 249 fprintf(stderr, "Unable to open configuration file for reading\n" 250 "Tried the following locations:\n" 251 " - %s\n" 252 " - %s\n" 253 "Error: %s\n", orig, fd_g_config->cnf_file, strerror(ret)); 254 } else { 255 fprintf(stderr, "Unable to open '%s' for reading: %s\n", fd_g_config->cnf_file, strerror(ret)); 256 } 250 TRACE_DEBUG_ERROR("Unable to open configuration file for reading; tried the following locations: %s%s%s; Error: %s\n", 251 orig ?: "", orig? " and " : "", fd_g_config->cnf_file, strerror(ret)); 257 252 return ret; 258 253 }
Note: See TracChangeset
for help on using the changeset viewer.