Module: wine
Branch: master
Commit: 9bc5bc7c6628a69cef6e64facb8eb7e3cf2e269b
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9bc5bc7c6628a69cef6e64fa…
Author: Zebediah Figura <zfigura(a)codeweavers.com>
Date: Mon Jul 26 11:53:45 2021 -0500
server: Remove the socket from the polling loop if it was aborted.
Don't use rd_shutdown and wr_shutdown to determine this. On the one hand, it's
possible to have pending asyncs even if rd_shutdown && wr_shutdown, which will
be cheerfully completed upon receiving data. On the other hand, RST doesn't
cause WSAESHUTDOWN, but rather WSAECONNRESET.
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
server/sock.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/server/sock.c b/server/sock.c
index 2d2aa733565..2660cf2dee0 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -215,6 +215,7 @@ struct sock
unsigned int wr_shutdown : 1; /* is the write end shut down? */
unsigned int wr_shutdown_pending : 1; /* is a write shutdown pending? */
unsigned int hangup : 1; /* has the read end received a hangup? */
+ unsigned int aborted : 1; /* did we get a POLLERR or irregular POLLHUP? */
unsigned int nonblocking : 1; /* is the socket nonblocking? */
unsigned int bound : 1; /* is the socket bound? */
};
@@ -1079,8 +1080,7 @@ static void sock_poll_event( struct fd *fd, int event )
}
else if (event & (POLLHUP | POLLERR))
{
- sock->rd_shutdown = 1;
- sock->wr_shutdown = 1;
+ sock->aborted = 1;
if (debug_level)
fprintf( stderr, "socket %p aborted by error %d, event %#x\n", sock, error, event );
@@ -1175,6 +1175,9 @@ static int sock_get_poll_events( struct fd *fd )
return -1;
}
+ if (sock->aborted)
+ return -1;
+
if (sock->accept_recv_req)
{
ev |= POLLIN;
@@ -1403,6 +1406,7 @@ static struct sock *create_socket(void)
sock->wr_shutdown = 0;
sock->wr_shutdown_pending = 0;
sock->hangup = 0;
+ sock->aborted = 0;
sock->nonblocking = 0;
sock->bound = 0;
sock->rcvbuf = 0;
Module: wine
Branch: master
Commit: 361435f6095f8c759979600b06ed28785e7b3aec
URL: https://source.winehq.org/git/wine.git/?a=commit;h=361435f6095f8c759979600b…
Author: Zebediah Figura <zfigura(a)codeweavers.com>
Date: Mon Jul 26 11:53:44 2021 -0500
server: Remove the socket from the polling loop if both it and the peer have SHUT_WR.
Based on a patch by Torge Matthies.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51319
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
server/sock.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/server/sock.c b/server/sock.c
index 85ea019ad92..2d2aa733565 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -1161,6 +1161,20 @@ static int sock_get_poll_events( struct fd *fd )
case SOCK_CONNECTED:
case SOCK_CONNECTIONLESS:
+ if (sock->hangup && sock->wr_shutdown && !sock->wr_shutdown_pending)
+ {
+ /* Linux returns POLLHUP if a socket is both SHUT_RD and SHUT_WR, or
+ * if both the socket and its peer are SHUT_WR.
+ *
+ * We don't use SHUT_RD, so we can only encounter this in the latter
+ * case. In that case there can't be any pending read requests (they
+ * would have already been completed with a length of zero), the
+ * above condition ensures that we don't have any pending write
+ * requests, and nothing that can change about the socket state that
+ * would complete a pending poll request. */
+ return -1;
+ }
+
if (sock->accept_recv_req)
{
ev |= POLLIN;
@@ -1267,7 +1281,10 @@ static void sock_reselect_async( struct fd *fd, struct async_queue *queue )
struct sock *sock = get_fd_user( fd );
if (sock->wr_shutdown_pending && list_empty( &sock->write_q.queue ))
+ {
shutdown( get_unix_fd( sock->fd ), SHUT_WR );
+ sock->wr_shutdown_pending = 0;
+ }
/* Don't reselect the ifchange queue; we always ask for POLLIN.
* Don't reselect an uninitialized socket; we can't call set_fd_events() on
Module: wine
Branch: master
Commit: ec07f285e2e71f1c3696989d9f05faf4dc87cdae
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ec07f285e2e71f1c3696989d…
Author: Zebediah Figura <zfigura(a)codeweavers.com>
Date: Mon Jul 26 11:53:43 2021 -0500
server: Separate SD_RECEIVE and hangup conditions.
This patch does result in one functional change: if we are selecting for
AFD_POLL_READ on a socket which has had SD_RECEIVE and there are no asyncs, we
will now respond to POLLIN instead of ignoring it. Neither this nor the previous
behaviour matches Windows, which instead puts the socket into an aborted state
and sends RST to the peer if any data is received after SD_RECEIVE or if
SD_RECEIVE is done while there is pending data.
Apart from this there is no functional change, as the places where rd_shutdown
alone is checked can't be reached if there was a hangup. It is instead for
semantic clarity.
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
server/sock.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/server/sock.c b/server/sock.c
index e5b0e81ead2..85ea019ad92 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -214,6 +214,7 @@ struct sock
unsigned int rd_shutdown : 1; /* is the read end shut down? */
unsigned int wr_shutdown : 1; /* is the write end shut down? */
unsigned int wr_shutdown_pending : 1; /* is a write shutdown pending? */
+ unsigned int hangup : 1; /* has the read end received a hangup? */
unsigned int nonblocking : 1; /* is the socket nonblocking? */
unsigned int bound : 1; /* is the socket bound? */
};
@@ -930,7 +931,7 @@ static int sock_dispatch_asyncs( struct sock *sock, int event, int error )
int status = sock_get_ntstatus( error );
struct accept_req *req, *next;
- if (sock->rd_shutdown)
+ if (sock->rd_shutdown || sock->hangup)
async_wake_up( &sock->read_q, status );
if (sock->wr_shutdown)
async_wake_up( &sock->write_q, status );
@@ -1072,15 +1073,17 @@ static void sock_poll_event( struct fd *fd, int event )
}
}
- if ((hangup_seen || event & (POLLHUP | POLLERR)) && (!sock->rd_shutdown || !sock->wr_shutdown))
+ if (hangup_seen || (sock_shutdown_type == SOCK_SHUTDOWN_POLLHUP && (event & POLLHUP)))
+ {
+ sock->hangup = 1;
+ }
+ else if (event & (POLLHUP | POLLERR))
{
- error = error ? error : sock_error( fd );
- if ( (event & POLLERR) || ( sock_shutdown_type == SOCK_SHUTDOWN_EOF && (event & POLLHUP) ))
- sock->wr_shutdown = 1;
sock->rd_shutdown = 1;
+ sock->wr_shutdown = 1;
if (debug_level)
- fprintf(stderr, "socket %p aborted by error %d, event: %x\n", sock, error, event);
+ fprintf( stderr, "socket %p aborted by error %d, event %#x\n", sock, error, event );
}
if (hangup_seen)
@@ -1168,7 +1171,9 @@ static int sock_get_poll_events( struct fd *fd )
}
else
{
- if (!sock->rd_shutdown)
+ /* Don't ask for POLLIN if we got a hangup. We won't receive more
+ * data anyway, but we will get POLLIN if SOCK_SHUTDOWN_EOF. */
+ if (!sock->hangup)
{
if (mask & AFD_POLL_READ)
ev |= POLLIN;
@@ -1380,6 +1385,7 @@ static struct sock *create_socket(void)
sock->rd_shutdown = 0;
sock->wr_shutdown = 0;
sock->wr_shutdown_pending = 0;
+ sock->hangup = 0;
sock->nonblocking = 0;
sock->bound = 0;
sock->rcvbuf = 0;
Module: wine
Branch: master
Commit: 2197bc9a92fac63b9ffe1008e0c74261028ad3e1
URL: https://source.winehq.org/git/wine.git/?a=commit;h=2197bc9a92fac63b9ffe1008…
Author: Francois Gouget <fgouget(a)codeweavers.com>
Date: Mon Jul 26 11:55:45 2021 +0200
winetest: Fix handling of relative -d directories.
Convert them to an absolute path so they result in a command line which
is still valid after changing the current directory in CreateProcess().
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
programs/winetest/main.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/programs/winetest/main.c b/programs/winetest/main.c
index fa773e28d4f..7ced565447b 100644
--- a/programs/winetest/main.c
+++ b/programs/winetest/main.c
@@ -1066,7 +1066,10 @@ run_tests (char *logname, char *outdir)
report (R_FATAL, "Could not open logfile: %u", GetLastError());
if (outdir)
- strcpy( tempdir, outdir);
+ {
+ /* Get a full path so it is still valid after a chdir */
+ GetFullPathNameA( outdir, ARRAY_SIZE(tempdir), tempdir, NULL );
+ }
else
{
strcpy( tempdir, tmppath );
Module: wine
Branch: master
Commit: 9f72c5601173728c52626342a1ec6c9a4c70670f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9f72c5601173728c52626342…
Author: Francois Gouget <fgouget(a)free.fr>
Date: Fri Jul 23 13:18:35 2021 +0200
riched20: Tweak the wording of a comment.
Signed-off-by: Francois Gouget <fgouget(a)free.fr>
Signed-off-by: Huw Davies <huw(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
dlls/riched20/tests/editor.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 3a6a072f1f8..ab74e0ef1ab 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -8995,8 +8995,8 @@ static void test_EM_SELECTIONTYPE(void)
START_TEST( editor )
{
BOOL ret;
- /* Must explicitly LoadLibrary(). The test has no references to functions in
- * RICHED20.DLL, so the linker doesn't actually link to it. */
+ /* Must explicitly LoadLibrary(). The test has no reference to functions in
+ * RICHED20.DLL, so the linker does not actually link to it. */
hmoduleRichEdit = LoadLibraryA("riched20.dll");
ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError());
is_lang_japanese = (PRIMARYLANGID(GetSystemDefaultLangID()) == LANG_JAPANESE);