~brianaker/gearmand/734663

« back to all changes in this revision

Viewing changes to libgearman-server/gearmand.c

  • Committer: Brian Aker
  • Date: 2011-02-22 16:57:21 UTC
  • Revision ID: brian@tangent.org-20110222165721-u32mbznlcspg6lab
Improve on error logging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
341
341
 
342
342
  /* If this fails, there is not much we can really do. This should never fail
343
343
     though if the main gearmand thread is still active. */
344
 
  if (write(gearmand->wakeup_fd[1], &buffer, 1) != 1)
 
344
  ssize_t written;
 
345
  if ((written= write(gearmand->wakeup_fd[1], &buffer, 1)) != 1)
345
346
  {
346
 
    gearmand_perror("write");
 
347
    if (written < 0)
 
348
    {
 
349
      gearmand_perror("write");
 
350
    }
 
351
    else
 
352
    {
 
353
      gearmand_log_error("gearmand_wakeup() incorrectly wrote %lu bytes of data.", (unsigned long)written);
 
354
    }
347
355
  }
348
356
}
349
357
 
373
381
    ret= getaddrinfo(gearmand->host, port->port, &hints, &addrinfo);
374
382
    if (ret != 0)
375
383
    {
376
 
      gearmand_log_fatal("getaddrinfo:%s", gai_strerror(ret));
 
384
      gearmand_gai_error("getaddrinfo", ret);
377
385
      return GEARMAN_ERRNO;
378
386
    }
379
387
 
388
396
                       NI_NUMERICHOST | NI_NUMERICSERV);
389
397
      if (ret != 0)
390
398
      {
391
 
        gearmand_log_error("getnameinfo:%s", gai_strerror(ret));
 
399
        gearmand_gai_error("getaddrinfo", ret);
392
400
        strcpy(host, "-");
393
401
        strcpy(port->port, "-");
394
402
      }