OSDN Git Service

qtest: Add error reporting to socket_accept()
authorAndreas Färber <afaerber@suse.de>
Thu, 17 Apr 2014 16:38:25 +0000 (18:38 +0200)
committerAndreas Färber <afaerber@suse.de>
Mon, 5 May 2014 18:58:33 +0000 (20:58 +0200)
We're not using the GLib infrastructure here, to allow cleaning up the
sockets. Still, knowing why a certain test run failed can be valuable.

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
tests/libqtest.c

index 232f781..4b90d91 100644 (file)
@@ -93,6 +93,9 @@ static int socket_accept(int sock)
     do {
         ret = accept(sock, (struct sockaddr *)&addr, &addrlen);
     } while (ret == -1 && errno == EINTR);
+    if (ret == -1) {
+        fprintf(stderr, "%s failed: %s\n", __func__, strerror(errno));
+    }
     close(sock);
 
     return ret;