p9dial: fix uninitialized sockaddr for local bind

When `p9dial` is given a non-nil "local" address to bind to,
the dial string was mistakening parsed into the _remote_ address
structure, and not the structure representing the local address.
It should, of course, parse into the local address structure.

This was flagged by a warning about passing a const pointer to
an uninitialized variable to `bind(2)`.

Signed-off-by: Dan Cross <cross@gajendra.net>
This commit is contained in:
Dan Cross
2026-03-30 07:46:21 -04:00
parent 4f90c1294f
commit de729d1148

View File

@@ -99,7 +99,7 @@ p9dial(char *addr, char *local, char *dummy2, int *dummy3)
close(s); close(s);
return -1; return -1;
} }
if(p9dialparse(buf, &net, &unix, &ss, &port) < 0){ if(p9dialparse(buf, &net, &unix, &ssl, &port) < 0){
badlocal: badlocal:
free(buf); free(buf);
close(s); close(s);