$NetBSD: patch-ap,v 1.1 2004/05/06 13:46:23 taca Exp $

--- popper/main.c.orig	Fri Apr 23 18:39:01 2004
+++ popper/main.c
@@ -236,6 +236,7 @@ main ( int argc, char *argv[] )
     fd_set              fdset_templ;
     fd_set              fdset_read;
     int                 fd_flags    = 0;
+    FILE		*fp;
 
 
     if ( argc >= 2 && ( strncmp ( argv[1], "-v",  2 ) == 0 ||
@@ -636,7 +637,7 @@ main ( int argc, char *argv[] )
 	TRACE ( trace_file, POP_DEBUG, HERE, "listening using socket fd %d",
 		sockfd );
 
-	listen ( sockfd, 5 );
+	listen ( sockfd, SOMAXCONN );
 
 	/*
 	 * Set file descriptor to be non-blocking in case there isn't really a
@@ -761,6 +762,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 ) 
     {
