Commit 31e598d2 authored by Yang Tse's avatar Yang Tse
Browse files

add debug messages for initialization failures

parent cbf58d88
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -224,6 +224,7 @@ static int file_lookup(union ares_addr *addr, int family, struct hostent **host)
      switch(error) 
        {
        case ENOENT:
        case ESRCH:
          return ARES_ENOTFOUND;
        default:
          DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
+17 −2
Original line number Diff line number Diff line
@@ -248,6 +248,7 @@ static int file_lookup(const char *name, int family, struct hostent **host)
  FILE *fp;
  char **alias;
  int status;
  int error;

#ifdef WIN32
  char PATH_HOSTS[MAX_PATH];
@@ -280,8 +281,22 @@ static int file_lookup(const char *name, int family, struct hostent **host)

  fp = fopen(PATH_HOSTS, "r");
  if (!fp)
    {
      error = ERRNO;
      switch(error) 
        {
        case ENOENT:
        case ESRCH:
          return ARES_ENOTFOUND;

        default:
          DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
                         error, strerror(error)));
          DEBUGF(fprintf(stderr, "Error opening file: %s\n", 
                         PATH_HOSTS));
          *host = NULL;
          return ARES_EFILE;
        }
    }
  while ((status = ares__get_hostent(fp, family, host)) == ARES_SUCCESS)
    {
      if (strcasecmp((*host)->h_name, name) == 0)
+4 −0
Original line number Diff line number Diff line
@@ -639,6 +639,7 @@ DhcpNameServer
      error = ERRNO;
      switch(error) {
      case ENOENT:
      case ESRCH:
        status = ARES_EOF;
        break;
      default:
@@ -664,6 +665,7 @@ DhcpNameServer
        error = ERRNO;
        switch(error) {
        case ENOENT:
        case ESRCH:
          status = ARES_EOF;
          break;
        default:
@@ -690,6 +692,7 @@ DhcpNameServer
        error = ERRNO;
        switch(error) {
        case ENOENT:
        case ESRCH:
          status = ARES_EOF;
          break;
        default:
@@ -716,6 +719,7 @@ DhcpNameServer
        error = ERRNO;
        switch(error) {
        case ENOENT:
        case ESRCH:
          status = ARES_EOF;
          break;
        default:
+1 −0
Original line number Diff line number Diff line
@@ -273,6 +273,7 @@ static int single_domain(ares_channel channel, const char *name, char **s)
              switch(error) 
                {
                case ENOENT:
                case ESRCH:
                  break;
                default:
                  DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
+7 −3
Original line number Diff line number Diff line
@@ -353,7 +353,7 @@ static int juggle(curl_socket_t *sockfdp,
         client connecting. */
      sockfd = accept(sockfd, NULL, NULL);
      if(CURL_SOCKET_BAD == sockfd)
        logmsg("accept() failed\n");
        logmsg("accept() failed");
      else {
        logmsg("====> Client connect");
        write(fileno(stdout), "CNCT\n", 5);
@@ -438,7 +438,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock,

    if(getsockname(sock, (struct sockaddr *) &add,
                   &socksize)<0) {
      fprintf(stderr, "getsockname() failed");
      logmsg("getsockname() failed with error: %d", SOCKERRNO);
      return CURL_SOCKET_BAD;
    }
    *port = ntohs(add.sin_port);
@@ -489,6 +489,7 @@ int main(int argc, char *argv[])
  FILE *pidfile;
  char *pidname= (char *)".sockfilt.pid";
  int rc;
  int error;
  int arg=1;
  enum sockmode mode = PASSIVE_LISTEN; /* default */

@@ -631,7 +632,10 @@ int main(int argc, char *argv[])
    logmsg("Wrote pid %d to %s", pid, pidname);
  }
  else {
    fprintf(stderr, "Couldn't write pid file\n");
    error = ERRNO;
    logmsg("fopen() failed with error: %d %s\n", error, strerror(error));
    logmsg("Error opening file: %s\n", pidname);
    logmsg("Couldn't write pid file\n");
    sclose(sock);
    return 1;
  }
Loading