Use accept4 with O_NONBLOCK rather than accept + fcntl

This commit is contained in:
Baptiste Daroussin 2016-10-01 11:43:37 +00:00
parent 062b8022ac
commit 734bfbc5b0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=306554

View File

@ -73,10 +73,8 @@ dbg_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
printf("Waiting for connection from gdb\r\n");
printonce = 1;
}
conn_fd = accept(listen_fd, NULL, NULL);
if (conn_fd >= 0)
fcntl(conn_fd, F_SETFL, O_NONBLOCK);
else if (errno != EINTR)
conn_fd = accept4(listen_fd, NULL, NULL, O_NONBLOCK);
if (conn_fd < 0 && errno != EINTR)
perror("accept");
}