prlimit.c: Fix up whitespace.
[misc] / qmail-checkspam.c
index 578dcf8..7847769 100644 (file)
@@ -7,18 +7,18 @@
  * (c) 2003 Mark Wooding
  */
 
-/*----- Licensing notice --------------------------------------------------* 
+/*----- Licensing notice --------------------------------------------------*
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -28,6 +28,7 @@
 
 #include <ctype.h>
 #include <errno.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -106,8 +107,10 @@ int main(int argc, char *argv[])
   struct message m;
   int fd_m[2], fd_e[2];
   pid_t kid;
+  const char *qmq;
   int rc;
 
+  if (getenv("RELAYCLIENT")) goto exec;
   m.max_len = intenv("QMAIL_CHECKSPAM_MAXLEN", 2 * 1024 * 1024);
   m.timeout = intenv("QMAIL_CHECKSPAM_TIMEOUT", 300);
   rc = message_read(0, 0, &m);
@@ -147,8 +150,9 @@ int main(int argc, char *argv[])
   close(fd_e[0]);
   close(fd_m[1]);
   close(fd_e[1]);
-  execlp(strenv("QMAIL_CHECKSPAM_QUEUE", "/var/qmail/bin/qmail-queue"),
-        (char *)0);
+exec:
+  qmq = strenv("QMAIL_CHECKSPAM_QUEUE", "/var/qmail/bin/qmail-queue");
+  execlp(qmq, qmq, (char *)0);
   fprintf(stderr, "failed to exec: %s\n", strerror(errno));
   return (56);
 }