mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-11 23:25:17 +00:00
78 lines
2.3 KiB
Plaintext
78 lines
2.3 KiB
Plaintext
--- src/common/utils/unixsocket.C.orig Fri Feb 21 21:41:25 1997
|
|
+++ src/common/utils/unixsocket.C Wed Oct 20 19:35:42 1999
|
|
@@ -67,6 +67,9 @@
|
|
#if defined(BSDI)
|
|
# define DONT_HAVE_SENDFD
|
|
#endif
|
|
+#if defined(FreeBSD)
|
|
+# define DONT_HAVE_SENDFD
|
|
+#endif
|
|
|
|
#if ! (defined HAVE_SENDFD || defined DONT_HAVE_SENDFD)
|
|
#error SEND_FD
|
|
@@ -110,19 +113,29 @@
|
|
sock = ::socket (AF_UNIX, SOCK_STREAM, 0) ;
|
|
if (sock < 0) {
|
|
DEBUGNL ("UNIXSocket::connect(): could not create socket") ;
|
|
+#ifndef __FreeBSD__
|
|
set_errno_(::errno) ;
|
|
+#endif
|
|
perror_("UNIXSocket::connect(): ::socket()") ;
|
|
return false ;
|
|
}
|
|
if (::connect (sock, (struct sockaddr*)&addr, addrlen) < 0) {
|
|
+#ifdef __FreeBSD__
|
|
+ if (errno == ECONNREFUSED && retries > 0) {
|
|
+#else
|
|
if (::errno == ECONNREFUSED && retries > 0) {
|
|
+#endif
|
|
// try again since peer's backlog may just be full
|
|
::close (sock) ;
|
|
::sleep (1) ; // ++++
|
|
continue ;
|
|
} else {
|
|
DEBUGNL ("UNIXSocket::connect(): cannot connect") ;
|
|
+#ifdef __FreeBSD__
|
|
+ set_errno_(errno) ;
|
|
+#else
|
|
set_errno_(::errno) ;
|
|
+#endif
|
|
perror_("UNIXSocket::connect(): ::connect()") ;
|
|
::close (sock) ;
|
|
return false ;
|
|
@@ -143,7 +156,11 @@
|
|
int sock = ::socket (AF_UNIX, SOCK_STREAM, 0) ;
|
|
if (sock < 0) {
|
|
DEBUGNL ("UNIXSocket::listen(): could not create socket") ;
|
|
+#ifdef __FreeBSD__
|
|
+ set_errno_(errno) ;
|
|
+#else
|
|
set_errno_(::errno) ;
|
|
+#endif
|
|
perror_("UNIXSocket::listen(): ::socket()") ;
|
|
return false ;
|
|
}
|
|
@@ -160,14 +177,22 @@
|
|
// systems have 2 chars (len and family) instead.
|
|
if (::bind (sock, (struct sockaddr*)&addr, 2 + pathlen) < 0) {
|
|
DEBUGNL ("UNIXSocket::listen(): ::bind() error") ;
|
|
+#ifdef __FreeBSD__
|
|
+ set_errno_(errno) ;
|
|
+#else
|
|
set_errno_(::errno) ;
|
|
+#endif
|
|
perror_("UNIXSocket::listen(): ::bind()") ;
|
|
::close (sock) ;
|
|
return false ;
|
|
}
|
|
if (::listen (sock, SOMAXCONN) < 0) {
|
|
DEBUGNL ("UNIXSocket::listen(): ::listen() error") ;
|
|
+#ifdef __FreeBSD__
|
|
+ set_errno_(errno) ;
|
|
+#else
|
|
set_errno_(::errno) ;
|
|
+#endif
|
|
perror_("UNIXSocket::listen(): ::listen()") ;
|
|
::close (sock);
|
|
return false ;
|