Thanks for the suggestion Ben. I was thinking about changing the regular open to a CreateFile on Windows with the flag: ` FILE_FLAG_DELETE_ON_CLOSE 0x04000000
The file is to be deleted immediately after all of its handles are closed, which includes the specified handle and any other open or duplicated handles. If there are existing open handles to a file, the call fails unless they were all opened with the FILE_SHARE_DELETE share mode. Subsequent open requests for the file fail, unless the FILE_SHARE_DELETE share mode is specified.` https://docs.microsoft.com/en-us/windows/desktop/api/FileAPI/nf-fileapi-createfilea But both can work. > -----Mesaj original----- > De la: [email protected] <ovs-dev- > [email protected]> În numele Ben Pfaff > Trimis: Thursday, November 15, 2018 6:11 PM > Către: [email protected] > Cc: [email protected] > Subiect: Re: [ovs-dev] [PATCH] Tests: Fix testing bridge - add port after > stopping controller on Windows > > On Thu, Nov 15, 2018 at 03:23:28PM +0200, [email protected] wrote: > > I have opened an issue for it: > > https://github.com/openvswitch/ovs-issues/issues/165 > > > > It's not test specific unfortunately. The file is put up for unlink on > > exit, but I'm guessing someone still has an opened handle at that point. > > > > I'm applying this patch for the moment and following up with the > > actual fix for the userspace. > > Unix has similar-sounding issues with dangling Unix domain sockets. On > Unix, the customary way to solve it is to delete an existing socket before > trying to create one with the same name. You can see that in > make_unix_socket() in socket-util-unix.c: > > if (bind_path) { > char linkname[MAX_UN_LEN + 1]; > struct sockaddr_un un; > socklen_t un_len; > int dirfd; > > if (unlink(bind_path) && errno != ENOENT) { > VLOG_WARN("unlinking \"%s\": %s\n", > bind_path, ovs_strerror(errno)); > } > fatal_signal_add_file_to_unlink(bind_path); > > If that approach is appropriate under Windows as well, it might be > implemented something like this: > diff --git a/lib/stream-windows.c b/lib/stream-windows.c index > 34bc610b6f49..b027e48b4f8d 100644 > --- a/lib/stream-windows.c > +++ b/lib/stream-windows.c > @@ -616,6 +616,11 @@ pwindows_open(const char *name OVS_UNUSED, > char *suffix, > path = xstrdup(suffix); > } > > + /* Remove any existing named pipe. */ > + if (remove(bind_path) && errno != ENOENT) { > + VLOG_WARN("removing \"%s\": %s\n", bind_path, > ovs_strerror(errno)); > + } > + > /* Try to create a file under the path location. */ > FILE *file = fopen(path, "w"); > if (!file) { > _______________________________________________ > dev mailing list > [email protected] > https://mail.openvswitch.org/mailman/listinfo/ovs-dev _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
