Zebediah Figura (@zfigura) commented about dlls/ws2_32/tests/sock.c:
+{
- SOCKET server, client, conn;
- const SOCKADDR_UN addr = { AF_UNIX, "test_afunix.sock" };
- HANDLE clientThread;
- const char serverMsg[] = "ws2_32/AF_UNIX socket test";
- char clientBuf[sizeof(serverMsg)] = { 0 };
- int ret;
- server = socket(AF_UNIX, SOCK_STREAM, 0);
- ok(server != INVALID_SOCKET, "Could not create Unix socket: %lu\n",
GetLastError());
- ok(!bind(server, (SOCKADDR *)&addr, sizeof(SOCKADDR_UN)), "Could not bind Unix socket: %lu\n",
GetLastError());
- ok(!listen(server, 1), "Could not listen on Unix socket: %lu\n",
GetLastError());
This kind of thing should generally be avoided, because GetLastError() won't necessarily run after the bind call. Just use two separate lines.
(There may be precedent for the bad code earlier in the file, but this file is pretty much full of bad code.)