"David Reid" <david@jetnet.co.uk> writes:
> Looking at the code in pqcomm.c|h should a new define of
> NO_UNIX_SOCKETS be defined to clean up the defines around the unix
> socket code?
Yes, I was thinking that would be a good idea even before you sent
this patch. We already have QNX and WIN wanting to ifdef out
the unix-domain socket code, so it's time to make an OS-independent
name for that compilation flag.
I'm not sure if HAVE_SYS_UN_H is an appropriate way of testing
for it or not (I see you did it that way in a couple of places).
I'd rather make a new symbol HAVE_UNIX_SOCKETS, I think, and
ifdef the code on that basis.
Also, I object to coding like
saddr.sa.sa_family = family;
if (family == AF_UNIX)
{
+ #ifdef HAVE_SYS_UN_H /* we have unix sockets */
len = UNIXSOCK_PATH(saddr.un, portName);
strcpy(sock_path, saddr.un.sun_path);
! #endif
/*
* If the socket exists but nobody has an advisory lock on it we
* can safely delete the file.
If you are going to break the socket code path then you ought to disable
it completely, ie the whole "if (family == AF_UNIX)" path ought to be
commented out so that control must go to the TCP path. Falling through
a nonfunctional code path is not a good idea.
regards, tom lane