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

Commit0bdf46a

Browse files
committed
Fix some actual bugs exposed by compiler warnings.
(Someone forgot whether their subroutine signaled errors by a NULL pointerreturn value, or a negative integer... I'm surprised gcc -Wall doesn'tcatch this...)
1 parent3d87216 commit0bdf46a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 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.1 1998/10/22 20:40:46 momjian Exp $
6+
*$Id: network.c,v 1.2 1998/10/26 01:03:24 tgl Exp $
77
*Jon Postel RIP 16 Oct 1998
88
*/
99

@@ -313,7 +313,7 @@ network_host(inet *ip)
313313
if (ip_family(ip)==AF_INET)
314314
{
315315
/* It's an IP V4 address: */
316-
if (inet_net_ntop(AF_INET,&ip_v4addr(ip),32,tmp,sizeof(tmp))<0)
316+
if (inet_net_ntop(AF_INET,&ip_v4addr(ip),32,tmp,sizeof(tmp))==NULL)
317317
{
318318
elog(ERROR,"unable to print host (%s)",strerror(errno));
319319
return (NULL);
@@ -358,7 +358,7 @@ network_broadcast(inet *ip)
358358
/* It's an IP V4 address: */
359359
intaddr=htonl(ntohl(ip_v4addr(ip)) | (0xffffffff >>ip_bits(ip)));
360360

361-
if (inet_net_ntop(AF_INET,&addr,32,tmp,sizeof(tmp))<0)
361+
if (inet_net_ntop(AF_INET,&addr,32,tmp,sizeof(tmp))==NULL)
362362
{
363363
elog(ERROR,"unable to print address (%s)",strerror(errno));
364364
return (NULL);
@@ -397,7 +397,7 @@ network_network(inet *ip)
397397
/* It's an IP V4 address: */
398398
intaddr=ntohl(ip_v4addr(ip))& (0xffffffff << (32-ip_bits(ip)));
399399

400-
if (inet_cidr_ntop(AF_INET,&addr,32,tmp,sizeof(tmp))<0)
400+
if (inet_cidr_ntop(AF_INET,&addr,32,tmp,sizeof(tmp))==NULL)
401401
{
402402
elog(ERROR,"unable to print network (%s)",strerror(errno));
403403
return (NULL);
@@ -436,7 +436,7 @@ network_netmask(inet *ip)
436436
/* It's an IP V4 address: */
437437
intaddr=htonl((-1 << (32-ip_bits(ip)))&0xffffffff);
438438

439-
if (inet_net_ntop(AF_INET,&addr,32,tmp,sizeof(tmp))<0)
439+
if (inet_net_ntop(AF_INET,&addr,32,tmp,sizeof(tmp))==NULL)
440440
{
441441
elog(ERROR,"unable to print netmask (%s)",strerror(errno));
442442
return (NULL);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp