diff options
author | Epoch Qwert <epoch@53flpnlls43fcguy.onion> | 2014-12-30 07:25:39 -0600 |
---|---|---|
committer | Epoch Qwert <epoch@53flpnlls43fcguy.onion> | 2014-12-30 07:25:39 -0600 |
commit | 86ba931697790d4da2515f4457ebfb3f20b43860 (patch) | |
tree | 839c1f7ae94fd32639d3311c3a2faee34f88f04c /src/libexec/peerip.c | |
parent | 05d677a3d3e9e540dffd35c76e35335bf43ead7d (diff) | |
download | misc-86ba931697790d4da2515f4457ebfb3f20b43860.tar.gz misc-86ba931697790d4da2515f4457ebfb3f20b43860.zip |
all those .c changes were mostly fixes of warnings for the change in rebuild.sh being changed to use -Wall.
gethostbyname was almost completely rewritten to work better with ipv6 for gopherd.sh
gopherd.sh was rewritten to use gethostbyname instead of dig and to cut out any link-local interface indicators from the output of hop0 and to ignore an error if ipA -> hostname -> ipB causes ipA to be not the same as ipB.
Don't remember if there's anything else.
Diffstat (limited to 'src/libexec/peerip.c')
-rw-r--r-- | src/libexec/peerip.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/libexec/peerip.c b/src/libexec/peerip.c index 6bcf1f1..43d64d0 100644 --- a/src/libexec/peerip.c +++ b/src/libexec/peerip.c @@ -4,17 +4,11 @@ #include <netinet/in.h> int main(int argc,char *argv[]) { - int i; struct sockaddr_in6 sa6; - int err; - int sl=sizeof(sa6); + unsigned int sl=sizeof(sa6); char h[NI_MAXHOST], s[NI_MAXSERV]; - if(getpeername(0,(struct sockaddr *)&sa6,&sl) == -1) { - return 1; - } - if(err=getnameinfo((struct sockaddr *)&sa6,sl,h,sizeof(h),s,sizeof(s),NI_NUMERICHOST|NI_NUMERICSERV)) { - return 2; - } + if(getpeername(0,(struct sockaddr *)&sa6,&sl) == -1) return 1; + if(getnameinfo((struct sockaddr *)&sa6,sl,h,sizeof(h),s,sizeof(s),NI_NUMERICHOST|NI_NUMERICSERV)) return 2; puts(h); puts(s); return 0; |