Loading ares/ares_init.c +26 −5 Original line number Original line Diff line number Diff line Loading @@ -91,7 +91,8 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, int optmask) int optmask) { { ares_channel channel; ares_channel channel; int i, status; int i; int status = ARES_SUCCESS; struct server_state *server; struct server_state *server; struct timeval tv; struct timeval tv; Loading @@ -106,8 +107,10 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, #endif #endif channel = malloc(sizeof(struct ares_channeldata)); channel = malloc(sizeof(struct ares_channeldata)); if (!channel) if (!channel) { *channelptr = NULL; return ARES_ENOMEM; return ARES_ENOMEM; } /* Set everything to distinguished values so we know they haven't /* Set everything to distinguished values so we know they haven't * been set yet. * been set yet. Loading @@ -132,13 +135,31 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, /* Initialize configuration by each of the four sources, from highest /* Initialize configuration by each of the four sources, from highest * precedence to lowest. * precedence to lowest. */ */ if (status == ARES_SUCCESS) { status = init_by_options(channel, options, optmask); status = init_by_options(channel, options, optmask); if (status == ARES_SUCCESS) if (status != ARES_SUCCESS) DEBUGF(fprintf(stderr, "Error: init_by_options failed: %s\n", ares_strerror(status))); } if (status == ARES_SUCCESS) { status = init_by_environment(channel); status = init_by_environment(channel); if (status == ARES_SUCCESS) if (status != ARES_SUCCESS) DEBUGF(fprintf(stderr, "Error: init_by_environment failed: %s\n", ares_strerror(status))); } if (status == ARES_SUCCESS) { status = init_by_resolv_conf(channel); status = init_by_resolv_conf(channel); if (status == ARES_SUCCESS) if (status != ARES_SUCCESS) DEBUGF(fprintf(stderr, "Error: init_by_resolv_conf failed: %s\n", ares_strerror(status))); } if (status == ARES_SUCCESS) { status = init_by_defaults(channel); status = init_by_defaults(channel); if (status != ARES_SUCCESS) DEBUGF(fprintf(stderr, "Error: init_by_defaults failed: %s\n", ares_strerror(status))); } if (status != ARES_SUCCESS) if (status != ARES_SUCCESS) { { /* Something failed; clean up memory we may have allocated. */ /* Something failed; clean up memory we may have allocated. */ Loading Loading
ares/ares_init.c +26 −5 Original line number Original line Diff line number Diff line Loading @@ -91,7 +91,8 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, int optmask) int optmask) { { ares_channel channel; ares_channel channel; int i, status; int i; int status = ARES_SUCCESS; struct server_state *server; struct server_state *server; struct timeval tv; struct timeval tv; Loading @@ -106,8 +107,10 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, #endif #endif channel = malloc(sizeof(struct ares_channeldata)); channel = malloc(sizeof(struct ares_channeldata)); if (!channel) if (!channel) { *channelptr = NULL; return ARES_ENOMEM; return ARES_ENOMEM; } /* Set everything to distinguished values so we know they haven't /* Set everything to distinguished values so we know they haven't * been set yet. * been set yet. Loading @@ -132,13 +135,31 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, /* Initialize configuration by each of the four sources, from highest /* Initialize configuration by each of the four sources, from highest * precedence to lowest. * precedence to lowest. */ */ if (status == ARES_SUCCESS) { status = init_by_options(channel, options, optmask); status = init_by_options(channel, options, optmask); if (status == ARES_SUCCESS) if (status != ARES_SUCCESS) DEBUGF(fprintf(stderr, "Error: init_by_options failed: %s\n", ares_strerror(status))); } if (status == ARES_SUCCESS) { status = init_by_environment(channel); status = init_by_environment(channel); if (status == ARES_SUCCESS) if (status != ARES_SUCCESS) DEBUGF(fprintf(stderr, "Error: init_by_environment failed: %s\n", ares_strerror(status))); } if (status == ARES_SUCCESS) { status = init_by_resolv_conf(channel); status = init_by_resolv_conf(channel); if (status == ARES_SUCCESS) if (status != ARES_SUCCESS) DEBUGF(fprintf(stderr, "Error: init_by_resolv_conf failed: %s\n", ares_strerror(status))); } if (status == ARES_SUCCESS) { status = init_by_defaults(channel); status = init_by_defaults(channel); if (status != ARES_SUCCESS) DEBUGF(fprintf(stderr, "Error: init_by_defaults failed: %s\n", ares_strerror(status))); } if (status != ARES_SUCCESS) if (status != ARES_SUCCESS) { { /* Something failed; clean up memory we may have allocated. */ /* Something failed; clean up memory we may have allocated. */ Loading