summaryrefslogtreecommitdiff
path: root/mail/qpopper/patches/patch-ap
blob: 61ec0ccbc6d866f55adffdc5ea826014a8b5a1b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$NetBSD: patch-ap,v 1.3 2005/06/01 20:55:16 adrianp Exp $

--- popper/main.c.orig	2005-05-28 17:29:10.000000000 +0100
+++ popper/main.c
@@ -246,6 +246,7 @@ main ( int argc, char *argv[] )
     fd_set              fdset_templ;
     fd_set              fdset_read;
     int                 fd_flags    = 0;
+    FILE		*fp;
 
 
 #ifdef USE_PAM
@@ -625,7 +626,10 @@ main ( int argc, char *argv[] )
             "listening using socket fd %d", 
             sockfd );
 
-    listen ( sockfd, 5 );
+#ifndef SOMAXCONN
+#define SOMAXCONN 5
+#endif
+	listen ( sockfd, SOMAXCONN );
 
     /*
      * Set file descriptor to be non-blocking in case there isn't really a
@@ -655,6 +659,16 @@ main ( int argc, char *argv[] )
     signal ( SIGHUP,  VOIDSTAR hupit   );
     signal ( SIGTERM, VOIDSTAR cleanup );
 
+#ifndef PIDFILE
+#define        PIDFILE "/var/run/qpopper.pid"
+#endif
+    fp = fopen(PIDFILE, "w");
+    if (fp == NULL) {
+      err_dump ( HERE, "Unable to open %s", PIDFILE);
+    }
+    fprintf(fp, "%d\n", getpid());
+    fclose(fp);
+
     while ( TRUE ) 
     {
         if ( bClean )