summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f22c1a3)
SCCS-vsn: lib/libc/net/rcmd.c 4.5
-static char sccsid[] = "@(#)rcmd.c 4.4 %G%";
+static char sccsid[] = "@(#)rcmd.c 4.5 %G%";
#endif
#include <stdio.h>
#endif
#include <stdio.h>
extern errno;
char *index(), *sprintf();
extern errno;
char *index(), *sprintf();
rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
char **ahost;
rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
char **ahost;
int s, timo = 1;
struct sockaddr_in sin, sin2, from;
char c;
int s, timo = 1;
struct sockaddr_in sin, sin2, from;
char c;
int lport = IPPORT_RESERVED - 1;
struct hostent *hp;
int lport = IPPORT_RESERVED - 1;
struct hostent *hp;
}
*ahost = hp->h_name;
retry:
}
*ahost = hp->h_name;
retry:
- s = rresvport(rcmdoptions|SO_KEEPALIVE, &lport);
if (s < 0)
return (-1);
sin.sin_family = hp->h_addrtype;
if (s < 0)
return (-1);
sin.sin_family = hp->h_addrtype;
lport--;
if (fd2p == 0) {
write(s, "", 1);
lport--;
if (fd2p == 0) {
write(s, "", 1);
- int s2 = rresvport(rcmdoptions|SO_ACCEPTCONN, &lport), s3;
+ int s2 = rresvport(&lport), s3;
if (s2 < 0) {
(void) close(s);
return (-1);
}
listen(s2, 1);
if (s2 < 0) {
(void) close(s);
return (-1);
}
listen(s2, 1);
- socketaddr(s2, &sin2);
- port = htons((u_short)sin2.sin_port);
- (void) sprintf(num, "%d", port);
+ (void) sprintf(num, "%d", lport);
(void) write(s, num, strlen(num)+1);
{ int len = sizeof (from);
s3 = accept(s2, &from, &len, 0);
close(s2);
if (s3 < 0) {
perror("accept");
(void) write(s, num, strlen(num)+1);
{ int len = sizeof (from);
s3 = accept(s2, &from, &len, 0);
close(s2);
if (s3 < 0) {
perror("accept");
(void) close(*fd2p);
bad:
(void) close(s);
return (-1);
}
(void) close(*fd2p);
bad:
(void) close(s);
return (-1);
}
-rresvport(options, alport)
- int options, *alport;
+rresvport(alport)
+ int *alport;
{
struct sockaddr_in sin;
int s;
{
struct sockaddr_in sin;
int s;