View | Details | Raw Unified | Return to bug 2577
Collapse All | Expand All

(-)src/usr.bin/rlogin/kcmd.c (-4 / +8 lines)
Lines 106-112 Link Here
106
		return (-1);
106
		return (-1);
107
	}
107
	}
108
108
109
	host_save = malloc(strlen(hp->h_name) + 1);
109
	if (!(host_save = malloc(strlen(hp->h_name) + 1))) {
110
		perror("malloc");
111
		return -1;
112
	}
113
110
	strcpy(host_save, hp->h_name);
114
	strcpy(host_save, hp->h_name);
111
	*ahost = host_save;
115
	*ahost = host_save;
112
116
Lines 131-139 Link Here
131
		fcntl(s, F_SETOWN, pid);
135
		fcntl(s, F_SETOWN, pid);
132
		sin.sin_family = hp->h_addrtype;
136
		sin.sin_family = hp->h_addrtype;
133
#if defined(ultrix) || defined(sun)
137
#if defined(ultrix) || defined(sun)
134
		bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length);
138
		bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, sizeof sin.sin_addr);
135
#else
139
#else
136
		bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, hp->h_length);
140
		bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, sizeof sin.sin_addr);
137
#endif
141
#endif
138
		sin.sin_port = rport;
142
		sin.sin_port = rport;
139
		if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
143
		if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
Lines 162-168 Link Here
162
			perror(NULL);
166
			perror(NULL);
163
			hp->h_addr_list++;
167
			hp->h_addr_list++;
164
			bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr,
168
			bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr,
165
			    hp->h_length);
169
			    sizeof sin.sin_addr);
166
			fprintf(stderr, "Trying %s...\n",
170
			fprintf(stderr, "Trying %s...\n",
167
				inet_ntoa(sin.sin_addr));
171
				inet_ntoa(sin.sin_addr));
168
			continue;
172
			continue;

Return to bug 2577