mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-17 15:27:36 +00:00
If what we have is a struct sockaddr_storage * and what we want is a
struct sockaddr_storage *, there's no point in casting it prematurely to a struct sockaddr *. This unbreaks WARNS=6 on sparc64.
This commit is contained in:
parent
423120f127
commit
6eece4b5f1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=142329
@ -83,7 +83,7 @@ struct sockaddr_storage sa;
|
||||
|
||||
char default_shell[] = _PATH_BSHELL;
|
||||
|
||||
static void doit(struct sockaddr *);
|
||||
static void doit(struct sockaddr_storage *);
|
||||
static void getstr(char *, int, const char *);
|
||||
static void error(const char *fmt, ...);
|
||||
|
||||
@ -125,12 +125,12 @@ main(int argc, char *argv[])
|
||||
realhostname_sa(remote, sizeof(remote) - 1,
|
||||
(struct sockaddr *)&from, fromlen);
|
||||
|
||||
doit((struct sockaddr *)&from);
|
||||
doit(&from);
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void
|
||||
doit(struct sockaddr *fromp)
|
||||
doit(struct sockaddr_storage *fromp)
|
||||
{
|
||||
char cmdbuf[NCARGS+1], *cp;
|
||||
char user[16], pass[16];
|
||||
@ -159,15 +159,15 @@ doit(struct sockaddr *fromp)
|
||||
port = port * 10 + c - '0';
|
||||
}
|
||||
if (port != 0) {
|
||||
sd = socket(fromp->sa_family, SOCK_STREAM, 0);
|
||||
sd = socket(fromp->ss_family, SOCK_STREAM, 0);
|
||||
if (sd < 0)
|
||||
exit(1);
|
||||
bzero(&sa, sizeof(sa));
|
||||
sa.ss_family = fromp->sa_family;
|
||||
sa.ss_len = fromp->sa_len;
|
||||
sa.ss_family = fromp->ss_family;
|
||||
sa.ss_len = fromp->ss_len;
|
||||
if (bind(sd, (struct sockaddr *)&sa, sa.ss_len) < 0)
|
||||
exit(1);
|
||||
switch (fromp->sa_family) {
|
||||
switch (fromp->ss_family) {
|
||||
case AF_INET:
|
||||
((struct sockaddr_in *)fromp)->sin_port = htons(port);
|
||||
break;
|
||||
@ -177,7 +177,7 @@ doit(struct sockaddr *fromp)
|
||||
default:
|
||||
exit(1);
|
||||
}
|
||||
if (connect(sd, fromp, fromp->sa_len) < 0)
|
||||
if (connect(sd, (struct sockaddr *)fromp, fromp->ss_len) < 0)
|
||||
exit(1);
|
||||
}
|
||||
getstr(user, sizeof(user), "username");
|
||||
|
Loading…
Reference in New Issue
Block a user