Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit374d9a1

Browse files
committed
D'Arcy INET fix.
1 parent94e37a3 commit374d9a1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

‎src/backend/utils/adt/network.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*is for IP V4 CIDR notation, but prepared for V6: just
44
*add the necessary bits where the comments indicate.
55
*
6-
*$Id: network.c,v 1.2 1998/10/26 01:03:24 tgl Exp $
6+
*$Id: network.c,v 1.3 1998/10/29 04:41:44 momjian Exp $
77
*Jon Postel RIP 16 Oct 1998
88
*/
99

@@ -395,9 +395,9 @@ network_network(inet *ip)
395395
if (ip_family(ip)==AF_INET)
396396
{
397397
/* It's an IP V4 address: */
398-
intaddr=ntohl(ip_v4addr(ip))& (0xffffffff << (32-ip_bits(ip)));
399-
400-
if (inet_cidr_ntop(AF_INET,&addr,32,tmp,sizeof(tmp))==NULL)
398+
intaddr=htonl(ntohl(ip_v4addr(ip))& (0xffffffff << (32-ip_bits(ip))));
399+
400+
if (inet_cidr_ntop(AF_INET,&addr,ip_bits(ip),tmp,sizeof(tmp))<0)
401401
{
402402
elog(ERROR,"unable to print network (%s)",strerror(errno));
403403
return (NULL);
@@ -409,8 +409,6 @@ network_network(inet *ip)
409409
elog(ERROR,"unknown address family (%d)",ip_family(ip));
410410
return (NULL);
411411
}
412-
if ((ptr=strchr(tmp,'/'))!=NULL)
413-
*ptr=0;
414412
len=VARHDRSZ+strlen(tmp)+1;
415413
ret=palloc(len);
416414
if (ret==NULL)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp