On Sat, Mar 21, 2020 at 12:06:15PM +0000, Richard W.M. Jones wrote:
And assuming there's no way to get the socket peer, then the function
shouldn't be NULL (which will cause a segfault), but instead you
should make the function return an error. eg:
int
nbdkit_peer_name (struct sockaddr *addr, socklen_t *addrlen)
{
+#ifndef WINDOWS
[... existing code unchanged ...]
+#else
+ nbdkit_error ("returning peer name is not supported on Windows");
+ return -1;
+#endif
}
If the problem is that msys doesn't have struct sockaddr or socklen_t,
then I guess conditionally #defining them? Eric knows about this
better than I do.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html