STABLE14-aix-unix-sockets-fix-200803221

LICENSE IPL10
FIXES 88088

use aix's macro for the size of sockaddr_un


(cherry picked from commit 493afd1e59661e64120a8d655d6503ac396ca46b)
This commit is contained in:
Tom Keiser 2008-03-21 16:59:26 +00:00 committed by Derrick Brashear
parent 85a0ec50a5
commit 8079d39afb

View File

@ -162,6 +162,17 @@ extern int LogLevel;
*/ */
struct Lock FSYNC_handler_lock; struct Lock FSYNC_handler_lock;
/*
* On AIX, connect() and bind() require use of SUN_LEN() macro;
* sizeof(struct sockaddr_un) will not suffice.
*/
#if defined(AFS_AIX_ENV) && defined(USE_UNIX_SOCKETS)
#define AFS_SOCKADDR_LEN(sa) SUN_LEN(sa)
#else
#define AFS_SOCKADDR_LEN(sa) sizeof(*sa)
#endif
int int
FSYNC_clientInit(int f) FSYNC_clientInit(int f)
{ {
@ -177,7 +188,7 @@ FSYNC_clientInit(int f)
for (;;) { for (;;) {
FS_sd = getport(&addr); FS_sd = getport(&addr);
if (connect(FS_sd, (struct sockaddr *)&addr, sizeof(addr)) >= 0) if (connect(FS_sd, (struct sockaddr *)&addr, AFS_SOCKADDR_LEN(&addr)) >= 0)
return 1; return 1;
if (!f) { if (!f) {
FSYNC_clientFinis(); FSYNC_clientFinis();
@ -367,7 +378,7 @@ FSYNC_sync()
for (numTries = 0; numTries < MAX_BIND_TRIES; numTries++) { for (numTries = 0; numTries < MAX_BIND_TRIES; numTries++) {
if ((code = if ((code =
bind(AcceptSd, (struct sockaddr *)&addr, sizeof(addr))) == 0) bind(AcceptSd, (struct sockaddr *)&addr, AFS_SOCKADDR_LEN(&addr))) == 0)
break; break;
#ifdef USE_UNIX_SOCKETS #ifdef USE_UNIX_SOCKETS
code = errno; code = errno;