Index: popper/Makefile.in
--- popper/Makefile.in.orig	2005-04-26 05:14:37 +0200
+++ popper/Makefile.in	2005-04-28 12:41:52 +0200
@@ -192,11 +192,10 @@
 popper: ${OBJS} mangler_library common_library
 	${CC}   ${OBJS} -o popper ${mmangle_dir}/libmangle.a \
 	        -I${common_srcdir} ${common_dir}/libcommon.a \
-	        ${LIBS} ${LDFLAGS}
+	        ${LDFLAGS} ${LIBS}
 
 popauth: ${POPAUTHOBJS}
-	${CC}  -o popauth ${POPAUTHOBJS} ${NETWORK_LIBS} ${DBM_LIBS} \
-		${common_dir}/libcommon.a
+	${CC}  -o popauth ${POPAUTHOBJS} ${common_dir}/libcommon.a ${LDFLAGS} ${NETWORK_LIBS} ${DBM_LIBS} ${LIBS}
 
 poppassd: common_library
 	cd ${password_dir} && ${MAKE} all
Index: popper/main.c
--- popper/main.c.orig	2005-04-26 05:14:37 +0200
+++ popper/main.c	2005-04-28 12:41:52 +0200
@@ -277,12 +277,6 @@
     err_out = msg_out  = fopen ( "/dev/null", "w+" ); /* until we get set up */
 
     /*
-     * Ensure default port & address is in network order
-     */
-    addr = htonl ( addr );
-    port = htons ( port );
-
-    /*
      * Set defaults for Qargc and Qargv
      */
     Qargc = argc;
@@ -307,46 +301,35 @@
     ptr = argv [ 1 ];
     if ( argc >= 2 && ( *ptr == ':' || isdigit ( (int) *ptr ) ) )
     {
-        int            j = 0;
-        unsigned long  a = addr;
-        unsigned short n = port;
-        char           b [ 25 ] = "";
-        char          *q = b;
-
-        /*
-         * We might have an ip address first
-         */
-        if ( strchr ( ptr, '.' ) != NULL )
-            while ( *ptr == '.' || isdigit ( (int) *ptr ) )
-                *q++ = *ptr++;
-        
-        if ( *b != '\0' )
-        {
-            a   = inet_addr ( b );
-            ptr = strchr ( ptr, ':' );
-            if ( ptr != NULL )
-                ptr++;
+         char *cpIp = NULL;
+         char *cpPort = NULL;
+         char *cpDup;
+         char *cp;
+ 
+         if ((cpDup = strdup(ptr)) == NULL)
+             err_dump ( HERE, "unable to allocate memory to examine first argument" );
+         if ((cp = strchr(cpDup, ':')) != NULL) {
+             *cp++ = '\0'; /* a colon means both ip and port are given, split them */
+             if (*cpDup != '\0') /* do not accept empty strings */
+                 cpIp = cpDup;
+             if (*cp != '\0') /* do not accept empty strings */
+                 cpPort = cp;
         }
-        else
-        {
-            ptr = argv [ 1 ];
-            if ( *ptr == ':' )
-                ptr++;
+         else {
+             if (strchr (ptr, '.') != NULL)
+                 cpIp = cpDup;   /* no colon but a dot means a ip is given */
+             else
+                 cpPort = cpDup; /* no colon and no dot means a port is given */
         }
+         if (cpIp != NULL )
+             addr = inet_addr(cpIp);
+         if (cpPort != NULL )
+             port = atoi(cpPort);
+         free(cpDup);
 
-        /*
-         * We might have a port number
-         */
-        if ( ptr != NULL )
-            j = atoi ( ptr );
-
-        if ( a == BAD_ADDR || j == 0 || j > USHRT_MAX )
+        if ( addr == BAD_ADDR || port == 0 || port > USHRT_MAX )
             err_dump ( HERE, "invalid address and/or port: \"%s\"", argv[1] );
-        n = j;
 
-        port = htons ( n );
-        addr = a;
-        
         /*
          * Since we consumed the first specified parameter,
          * create our own argv that omits it, to pass on to
@@ -363,6 +346,8 @@
             Qargv [ rslt - 1 ] = argv [ rslt ];
         Qargc = argc - 1;
     }
+    /* Ensure address remains and default port becomes network byte order */
+    port = htons ( port );
 
     /*
      * Open the log
@@ -559,6 +544,22 @@
 
 #endif /* not _DEBUG */
 
+#ifdef PIDFILE
+    /*
+     * Write PID file. -- RSE
+     */
+    {
+        pid_t pid;
+        FILE *fp;
+
+        pid = getpid();
+        if ((fp = fopen(PIDFILE, "w")) == NULL)
+            err_dump(HERE, "Can't write pidfile '%s'", PIDFILE);
+        fprintf(fp, "%ld\n", (long)pid);
+        fclose(fp);
+    }
+#endif
+
     /*
      * Set up the socket on which we listen
      */
@@ -596,17 +597,9 @@
     rslt = bind ( sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr) );
     if ( rslt < 0 )
     {
-        if ( errno == EADDRINUSE )
-        {
-            fprintf ( stderr, "%s:%d in use\n",
-                      inet_ntoa ( serv_addr.sin_addr ),
-                      ntohs     ( serv_addr.sin_port ) );
-            return 1;
-        }
-        else
-            err_dump ( HERE, "Can't bind local address %s:%d",
-                       inet_ntoa ( serv_addr.sin_addr ),
-                       ntohs     ( serv_addr.sin_port ) );
+        err_dump ( HERE, "Can't bind local address %s:%d",
+                   inet_ntoa ( serv_addr.sin_addr ),
+                   ntohs     ( serv_addr.sin_port ) );
     }
 
     TRACE ( trace_file, POP_DEBUG, HERE,
Index: popper/pop_dropcopy.c
--- popper/pop_dropcopy.c.orig	2005-04-26 05:14:39 +0200
+++ popper/pop_dropcopy.c	2005-04-28 12:41:52 +0200
@@ -1232,6 +1232,10 @@
             return pop_msg ( p, POP_FAILURE, HERE,
                              "[SYS/TEMP] Unable to get temp drop name" );
         
+        /*
+         *  OpenPKG: enforce usage of "spool-dir" configuration option
+         */
+#if 0
         if ( stat ( p->temp_drop, &mybuf ) == -1 || mybuf.st_size <= 0 ) {
             if ( genpath ( p, 
                            p->temp_drop, 
@@ -1240,6 +1244,7 @@
                 return pop_msg ( p, POP_FAILURE, HERE,
                                  "[SYS/TEMP] Unable to get temp drop name" );
         }
+#endif
     }
     else {
         /*
