-/* $Cambridge: exim/src/src/spam.c,v 1.5 2005/04/27 10:00:18 ph10 Exp $ */
+/* $Cambridge: exim/src/src/spam.c,v 1.7 2005/06/10 13:29:36 tom Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
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,
* 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;
fclose(mbox_file);
return DEFER;
}
+#endif
wrote = send(spamd_sock,spamd_buffer + offset,read - offset,0);
+ if (wrote == -1)
+ {
+ log_write(0, LOG_MAIN|LOG_PANIC,
+ "spam acl condition: %s on spamd socket", strerror(errno));
+ close(spamd_sock);
+ fclose(mbox_file);
+ return DEFER;
+ }
if (offset + wrote != read) {
offset += wrote;
goto again;