aboutsummaryrefslogtreecommitdiff
path: root/inet/rexec.c
diff options
context:
space:
mode:
Diffstat (limited to 'inet/rexec.c')
-rw-r--r--inet/rexec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/inet/rexec.c b/inet/rexec.c
index 30b7cca..2a3a256 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -117,11 +117,14 @@ retry:
}
listen(s2, 1);
sa2len = sizeof (sa2);
- if (getsockname(s2, (struct sockaddr *)&sa2, &sa2len) < 0 ||
- sa2len != SA_LEN((struct sockaddr *)&sa2)) {
+ if (getsockname(s2, (struct sockaddr *)&sa2, &sa2len) < 0) {
perror("getsockname");
(void) __close(s2);
goto bad;
+ } else if (sa2len != SA_LEN((struct sockaddr *)&sa2)) {
+ __set_errno(EINVAL);
+ (void) __close(s2);
+ goto bad;
}
port = 0;
if (!getnameinfo((struct sockaddr *)&sa2, sa2len,