Page MenuHomeFreeBSD

D6398.id16401.diff
No OneTemporary

D6398.id16401.diff

Index: usr.sbin/rpc.statd/file.c
===================================================================
--- usr.sbin/rpc.statd/file.c
+++ usr.sbin/rpc.statd/file.c
@@ -82,8 +82,9 @@
struct addrinfo *ai1, *ai2;
int i;
- if (getaddrinfo(hostname, NULL, NULL, &ai1) != 0)
- ai1 = NULL;
+ ai1 = NULL;
+ ai2 = NULL;
+ getaddrinfo(hostname, NULL, NULL, &ai1);
for (i = 0, hp = status_info->hosts; i < status_info->noOfHosts; i++, hp++)
{
if (!strncasecmp(hostname, hp->hostname, SM_MAXSTRLEN))
@@ -91,9 +92,8 @@
result = hp;
break;
}
- if (hp->hostname[0] &&
- getaddrinfo(hp->hostname, NULL, NULL, &ai2) != 0)
- ai2 = NULL;
+ if (hp->hostname[0] != '\0')
+ getaddrinfo(hp->hostname, NULL, NULL, &ai2);
if (ai1 && ai2)
{
struct addrinfo *p1, *p2;
@@ -113,8 +113,10 @@
if (result)
break;
}
- if (ai2)
+ if (ai2) {
freeaddrinfo(ai2);
+ ai2 = NULL;
+ }
if (!spare_slot && !hp->monList && !hp->notifyReqd)
spare_slot = hp;
}
@@ -134,9 +136,8 @@
if (desired_size > status_file_len)
{
/* Extend file by writing 1 byte of junk at the desired end pos */
- lseek(status_fd, desired_size - 1, SEEK_SET);
- i = write(status_fd, &i, 1);
- if (i < 1)
+ if (lseek(status_fd, desired_size - 1, SEEK_SET) == -1 ||
+ write(status_fd, "\0", 1) < 0)
{
syslog(LOG_ERR, "Unable to extend status file");
return (NULL);

File Metadata

Mime Type
text/plain
Expires
Sat, Feb 28, 3:39 AM (15 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29050731
Default Alt Text
D6398.id16401.diff (1 KB)

Event Timeline