patch for unix domain sockets on freebsd

From: Taavi Talvik <[email protected]>
Date: Tue, 28 May 1996 02:32:39 +0300 (EET DST)

Hello !

Due to additional members in sockaddr_un structure on freebsd
the filenames used for unix sockets where one byte shorter than necessary.

Maybe even define following macro for other platforms too?
This is taken from /usr/include/sys/un.h on FreeBSD.

/* actual length of an initialized sockaddr_un */
#define SUN_LEN(su) \
        (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))

best regards,
taavi

*** orig/squid-1.0.beta9/src/ftpget.c Thu May 23 08:14:44 1996
--- squid-1.0.beta9/src/ftpget.c Tue May 28 02:21:09 1996
***************
*** 2256,2262 ****
--- 2256,2266 ----
        S2.sun_family = AF_UNIX;
        strcpy(S2.sun_path, arg);
        Debug(26, 1, ("Binding to UNIX socket '%s'\n", S2.sun_path));
+ #ifdef __FreeBSD__
+ i = SUN_LEN(&S2);
+ #else
        i = strlen(S2.sun_path) + sizeof(S2.sun_family);
+ #endif
        if (bind(sock, (struct sockaddr *) &S2, i) < 0) {
            log_errno2(__FILE__, __LINE__, "bind");
            sleep(5); /* sleep here so that the cache will restart us */
Received on Mon May 27 1996 - 16:33:08 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:32:26 MST