Hi,

I'm not much of a C programmer but I wanted to see hostnames instead of
addresses in poundctl output and I'm finding this patch (to poundctl.c in
version 2.4.5) does the job on linux (ipv4). I figured I'm not the only one
who wants this (or perhaps one of you will tell me why this is a bad idea).

Thanks to Robert for a great program.

- Jason

$ diff -c  poundctl.c poundctl.c.orig
*** poundctl.c    2009-12-03 23:29:42.000000000 -0500
--- poundctl.c.orig    2009-12-03 23:29:34.000000000 -0500
***************
*** 84,94 ****
          port = 0;
          break;
      }
!
!     char hostname[NI_MAXHOST] = "";
!     getnameinfo(addr->ai_addr, addr->ai_addrlen, hostname, 1025, NULL, 0,
0);
!
!     snprintf(res, UNIX_PATH_MAX - 1, "%s:%d", hostname, port);
  #else
  #error "Pound needs inet_ntop()"
  #endif
--- 84,90 ----
          port = 0;
          break;
      }
!     snprintf(res, UNIX_PATH_MAX - 1, "%s:%d", buf, port);
  #else
  #error "Pound needs inet_ntop()"
  #endif


Shorter patch:

87,91c87
<
<     char hostname[NI_MAXHOST] = "";
<     getnameinfo(addr->ai_addr, addr->ai_addrlen, hostname, 1025, NULL, 0,
0);
<
<     snprintf(res, UNIX_PATH_MAX - 1, "%s:%d", hostname, port);
---
>     snprintf(res, UNIX_PATH_MAX - 1, "%s:%d", buf, port);


--
To unsubscribe send an email with subject unsubscribe to [email protected].
Please contact [email protected] for questions.

Reply via email to