[exim-cvs] cvs commit: exim/exim-src/OS os.h-Darwin exim/ex…

Top Page
Delete this message
Reply to this message
Author: Tom Kistner
Date:  
To: exim-cvs
Subject: [exim-cvs] cvs commit: exim/exim-src/OS os.h-Darwin exim/exim-src/src exim.h spam.c
tom 2005/05/10 23:39:20 BST

  Modified files:
    exim-src/OS          os.h-Darwin 
    exim-src/src         exim.h spam.c 
  Log:
  Fix poll() being unavailable on Mac OSX 10.2


  Revision  Changes    Path
  1.2       +3 -0      exim/exim-src/OS/os.h-Darwin
  1.13      +2 -0      exim/exim-src/src/exim.h
  1.6       +7 -0      exim/exim-src/src/spam.c


  Index: os.h-Darwin
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/OS/os.h-Darwin,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- os.h-Darwin    6 Oct 2004 15:07:39 -0000    1.1
  +++ os.h-Darwin    10 May 2005 22:39:20 -0000    1.2
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/OS/os.h-Darwin,v 1.1 2004/10/06 15:07:39 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/OS/os.h-Darwin,v 1.2 2005/05/10 22:39:20 tom Exp $ */


/* Exim: OS-specific C header file for Darwin (Mac OS X) */

@@ -8,6 +8,9 @@
#define HAVE_SYS_MOUNT_H
#define PAM_H_IN_PAM
#define SIOCGIFCONF_GIVES_ADDR
+
+/* OSX 10.2 does not have poll.h, 10.3 does emulate it badly. */
+#define NO_POLL_H

   #define F_FREESP     O_TRUNC
   typedef struct flock flock_t;


  Index: exim.h
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/exim.h,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- exim.h    10 May 2005 10:19:11 -0000    1.12
  +++ exim.h    10 May 2005 22:39:20 -0000    1.13
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/exim.h,v 1.12 2005/05/10 10:19:11 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/exim.h,v 1.13 2005/05/10 22:39:20 tom Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -92,7 +92,9 @@
   #include <sys/file.h>
   #include <dirent.h>
   #include <netdb.h>
  +#ifndef NO_POLL_H
   #include <poll.h>
  +#endif
   #include <pwd.h>
   #include <grp.h>
   #include <syslog.h>


  Index: spam.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/spam.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- spam.c    27 Apr 2005 10:00:18 -0000    1.5
  +++ spam.c    10 May 2005 22:39:20 -0000    1.6
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/spam.c,v 1.5 2005/04/27 10:00:18 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/spam.c,v 1.6 2005/05/10 22:39:20 tom Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -40,7 +40,9 @@
     time_t start;
     size_t read, wrote;
     struct sockaddr_un server;
  +#ifndef NO_POLL_H
     struct pollfd pollfd;
  +#endif


     /* find the username from the option list */
     if ((user_name = string_nextinlist(&list, &sep,
  @@ -213,15 +215,19 @@
      * and we poll the desciptor to make sure that we can write without
      * blocking.  Short writes are gracefully handled and if the whole
      * trasaction takes too long it is aborted.
  +   * Note: poll() is not supported in OSX 10.2.
      */
  +#ifndef NO_POLL_H
     pollfd.fd = spamd_sock;
     pollfd.events = POLLOUT;
  +#endif
     fcntl(spamd_sock, F_SETFL, O_NONBLOCK);
     do {
       read = fread(spamd_buffer,1,sizeof(spamd_buffer),mbox_file);
       if (read > 0) {
         offset = 0;
   again:
  +#ifndef NO_POLL_H
         result = poll(&pollfd, 1, 1000);
         if (result == -1 && errno == EINTR)
           continue;
  @@ -239,6 +245,7 @@
           fclose(mbox_file);
           return DEFER;
         }
  +#endif
         wrote = send(spamd_sock,spamd_buffer + offset,read - offset,0);
         if (offset + wrote != read) {
           offset += wrote;