qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests/qtest: netdev: test stream and dgram backends


From: Michael S. Tsirkin
Subject: Re: [PATCH] tests/qtest: netdev: test stream and dgram backends
Date: Fri, 4 Nov 2022 08:15:33 -0400

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.

> The same for the abstract one, how to be sure we are not running the same
> test concurrently and select a different unix name?
> 
> I'm going to address all your comments and send a new version of the patch.
> 
> Thanks,
> Laurent




reply via email to

[Prev in Thread] Current Thread [Next in Thread]