On Fri, Nov 04, 2022 at 11:58:29AM +0100, Laurent Vivier wrote:
On 11/4/22 10:41, Daniel P. Berrangé wrote:
...
+static void test_stream_unix(void)
+{
+ QTestState *qts0, *qts1;
+ char *expect;
+ gchar *path;
+ int ret;
+
+ ret = g_file_open_tmp("netdev-XXXXXX", &path, NULL);
+ g_assert_true(ret >= 0);
+ close(ret);
This is creating a zero length plain file, and then paassing
that as a path for the UNIX socket.
This is pretty dubious and only works because the code will
be doing 'unlink' on the path. Just delete this as there's
no reason to pre-create anything on disk for UNIX sockets.
The idea here is to generate a path for the socket and to be sure this path
is actually not already in use.
if you unlink before use then it's racy though.