On the platform where my mail client runs (an older RedHat 9 box, with
glibc 2.3.2), htons is defined as a macro.  With isync 1.0.3, that
prevents this code from compiling:

  drv_imap.c:1245

    addr.sin_port = htons( srvc->port ? srvc->port :
    #ifdef HAVE_LIBSSL
                           srvc->use_imaps ? 993 :
    #endif
                           143 );

T get this error:

    drv_imap.c:1246:1: directives may not be used inside a macro argument

The fix is to store port in a variable, then use the variable as an
argument to htons.  A small patch is attached.

Thanks,

----Scott.
diff -ur isync-1.0.3/src/drv_imap.c isync-1.0.3-sg/src/drv_imap.c
--- isync-1.0.3/src/drv_imap.c	2006-11-01 02:15:09.000000000 -0500
+++ isync-1.0.3-sg/src/drv_imap.c	2007-09-20 12:29:17.000000000 -0400
@@ -1194,6 +1194,7 @@
 	struct hostent *he;
 	struct sockaddr_in addr;
 	int s, a[2], preauth;
+        int port;
 #if HAVE_LIBSSL
 	int use_ssl;
 #endif
@@ -1242,11 +1243,13 @@
 		info( "ok\n" );
 	} else {
 		memset( &addr, 0, sizeof(addr) );
-		addr.sin_port = htons( srvc->port ? srvc->port :
+                port = srvc->port ? srvc->port :
 #ifdef HAVE_LIBSSL
-		                       srvc->use_imaps ? 993 :
+		       srvc->use_imaps ? 993 :
 #endif
-		                       143 );
+		       143;
+		addr.sin_port = htons( port );
+		                       
 		addr.sin_family = AF_INET;
 
 		info( "Resolving %s... ", srvc->host );
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to