system/fastboot: fix socket() parameter order for TCP transport

SOCK_CLOEXEC and SOCK_NONBLOCK were incorrectly passed as the
third argument (protocol) instead of being OR'd into the second
argument (type). This caused socket() to fail with EPROTONOSUPPORT
(errno 93) on NuttX.

Move SOCK_CLOEXEC | SOCK_NONBLOCK to the type parameter and set
protocol to 0.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
wangjianyu3 2026-03-20 13:53:36 +08:00 committed by Alan C. Assis
parent b986eef7a7
commit 460281a90f

View file

@ -1295,8 +1295,9 @@ static int fastboot_tcp_initialize(FAR struct fastboot_ctx_s *ctx)
netinit_bringup();
#endif
ctx->tran_fd[0] = socket(AF_INET, SOCK_STREAM,
SOCK_CLOEXEC | SOCK_NONBLOCK);
ctx->tran_fd[0] = socket(AF_INET,
SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK,
0);
if (ctx->tran_fd[0] < 0)
{
fb_err("create socket failed %d", errno);