[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fix for smtp.c on Solaris



The setsockopt() call is wrong everywhere (I think), but only on
Solaris does it cause a core dump.

*** 1.2	1993/04/29 18:40:31
--- smtp.c	1993/05/26 15:29:28
***************
*** 31,36 ****
--- 31,37 ----
  #define	BIND		/* Want BIND (named) nameserver support enabled */
  #endif	/* TRY_AGAIN */
  #ifdef	BIND
+ #undef NOERROR				/* pinhead SunOS 5.1 */
  #include <arpa/nameser.h>
  #include <resolv.h>
  
***************
*** 813,821 ****
  	bcopy(ipaddrcp, (char *)&sad.sin_addr, ipaddrlen);
  	sad.sin_port = htons((u_short)IPPORT_SMTP);
  	if (connect(s, (struct sockaddr *)&sad, sizeof sad) >= 0) {
  		*fdp = s;
  #if	BSD >= 43
! 		(void) setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, 1, sizeof (int));
  #else	/* BSD < 43 */
  		(void) setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, 0, 0);
  #endif	/* BSD >= 43 */
--- 814,823 ----
  	bcopy(ipaddrcp, (char *)&sad.sin_addr, ipaddrlen);
  	sad.sin_port = htons((u_short)IPPORT_SMTP);
  	if (connect(s, (struct sockaddr *)&sad, sizeof sad) >= 0) {
+ 		int on = 1;
  		*fdp = s;
  #if	BSD >= 43
! 		(void) setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof on);
  #else	/* BSD < 43 */
  		(void) setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, 0, 0);
  #endif	/* BSD >= 43 */