On 11/02/2011 02:24 PM, Stefan Berger wrote:
@@ -214,6 +219,19 @@ static int testSocketUNIXAccept(const void
*data
ATTRIBUTE_UNUSED)
}
}
+ if (strlen(path) >= sizeof(sun.sun_path)) {
+ if (!virStrcpy(path, "/tmp/test.sock.XXXXXX", sizeof(sun.sun_path))) {
+ VIR_DEBUG("Unexpected error using virStrcpyStatic");
+ goto cleanup;
+ }
+ tmpfd = mkostemp(path, 0700);
+ if (tmpfd < 0) {
+ virReportSystemError(errno, "%s",
+ _("Failed to create temporary file"));
+ goto cleanup;
+ }
+ }
+
if (virNetSocketNewListenUNIX(path, 0700, -1, getgid(), &lsock) < 0)
This relies on the guts of NewListenUNIX to do an unlink() of the file
that we still have an open fd on, and create a socket in its place;
which is slightly racy, not to mention non-portable to platforms where
unlink() fails with open fds (then again, Unix sockets don't exist on
those platforms - specifically mingw).
But we already have precedence of skipping tests in deep hierarchies:
TEST: daemon-conf
.................................../../../../../tests/daemon-conf:
skipping test: CWD too long
SKIP: daemon-conf
Maybe we should just skip instead of playing around with /tmp in that case?
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org