Navigation



Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libfdcore/config.c

    r947 r897  
    230230{
    231231        extern FILE * fddin;
    232         const char * orig = NULL;
     232        char * orig = NULL;
    233233       
    234234        /* Attempt to find the configuration file */
     
    238238        fddin = fopen(fd_g_config->cnf_file, "r");
    239239        if ((fddin == NULL) && (*fd_g_config->cnf_file != '/')) {
    240                 char * new_cnf = NULL;
    241240                /* We got a relative path, attempt to add the default directory prefix */
    242241                orig = fd_g_config->cnf_file;
    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;
     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 );
    246244                fddin = fopen(fd_g_config->cnf_file, "r");
    247245        }
    248246        if (fddin == NULL) {
    249247                int ret = errno;
    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));
     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                }
    252257                return ret;
    253258        }
     
    347352                                fd_list_unlink(&ep->chain);
    348353                                if (TRACE_BOOL(INFO)) {
    349                                         char buf[1024];
    350                                         sSA_DUMP_NODE( buf, sizeof(buf), &ep->sa, NI_NUMERICHOST );
    351                                         fd_log_debug("Info: Removing local address conflicting with the flags no_IP / no_IP6 : %s\n", buf);
     354                                        fd_log_debug("Info: Removing local address conflicting with the flags no_IP / no_IP6 : ");
     355                                        sSA_DUMP_NODE( &ep->sa, NI_NUMERICHOST );
     356                                        fd_log_debug("\n");
    352357                                }
    353358                                free(ep);
Note: See TracChangeset for help on using the changeset viewer.