From 0b9d15b8dcc3383a60c35245911d7153b9bfd7b7 Mon Sep 17 00:00:00 2001
From: Michael Krelin <hacker@klever.net>
Date: Wed, 25 Jul 2007 22:07:11 +0000
Subject: added missing files for previous commit

---
diff --git a/www-misc/pglogd/files/digest-pglogd-2.3-r1 b/www-misc/pglogd/files/digest-pglogd-2.3-r1
new file mode 100644
index 0000000..1d5af03
--- a/dev/null
+++ b/www-misc/pglogd/files/digest-pglogd-2.3-r1
@@ -0,0 +1,3 @@
+MD5 49e494598d1502cf2a20356146fab654 pglogd-2.3.tar.gz 22796
+RMD160 7e9264af8130b3fb5bd3dc89718fb4dfa28e1ec6 pglogd-2.3.tar.gz 22796
+SHA256 2a0e81cc0e0ab3132a48f11834908fdc6b8e4d70c0e6c12dff8815bc93582e78 pglogd-2.3.tar.gz 22796
diff --git a/www-misc/pglogd/files/pglogd-2.3-foreground.patch b/www-misc/pglogd/files/pglogd-2.3-foreground.patch
new file mode 100644
index 0000000..9ccf1e4
--- a/dev/null
+++ b/www-misc/pglogd/files/pglogd-2.3-foreground.patch
@@ -0,0 +1,82 @@
+diff --git a/pglogd.c b/pglogd.c
+index 4635a4c..c13f1c2 100644
+--- a/pglogd.c
++++ b/pglogd.c
+@@ -210,6 +210,7 @@ main(int argc, char **argv)
+ 	 */
+ 	char *cpConfigFile;			/* The user supplied configuration file. */
+ 	int iSkipDatabase;			/* Whether or not to skip the database connection at start-up. */
++	int iDaemonize;				/* Whether to become a daemon */
+ 
+ 
+ 	/*
+@@ -266,13 +267,15 @@ main(int argc, char **argv)
+ 
+ 	cpConfigFile = NULL;
+ 	iSkipDatabase = FALSE;
++	iDaemonize = TRUE;
+ 
+ 
+ 	/*
+-	 * Check for our two options:
++	 * Check for our three options:
+ 	 *
+ 	 *  1. Skip connecting to the database at statup.
+ 	 *  2. Read from a specified config file.
++	 *  3. Run in foreground.
+ 	 */
+ 	for ( i = 1 ; i < argc ; i++ )
+ 	{
+@@ -284,6 +287,8 @@ main(int argc, char **argv)
+ 
+ 		else if ( strncmp(&(*argv[i]), "-s", 2) == 0 )
+ 			iSkipDatabase = TRUE;
++		else if ( strncmp(&(*argv[i]), "-f", 2) == 0 )
++		    	iDaemonize = FALSE;
+ 	}
+ 
+ 
+@@ -352,26 +357,28 @@ main(int argc, char **argv)
+ 	}
+ 
+ 
+-	/*
+-	 * Become a deamon, muhaaaa
+-	 */
+-	if ( (pPid = fork()) < 0 )
+-	{
+-		fprintf(stderr, "%s: Fatal error, could not fork() [%d]\n", cpAppName, errno);
+-		exit(ERR_FORK);
+-	}
++	if(iDaemonize) {
++	    /*
++	     * Become a deamon, muhaaaa
++	     */
++	    if ( (pPid = fork()) < 0 )
++	    {
++		    fprintf(stderr, "%s: Fatal error, could not fork() [%d]\n", cpAppName, errno);
++		    exit(ERR_FORK);
++	    }
+ 
+-	else if ( pPid != 0 )
+-		exit(ERR_NORMAL);
++	    else if ( pPid != 0 )
++		    exit(ERR_NORMAL);
+ 
+ 
+-	/*
+-	 * Parent is gone, the child becomes the session leader.
+-	 */
+-	setsid();
++	    /*
++	     * Parent is gone, the child becomes the session leader.
++	     */
++	    setsid();
++	    iDaemon = 1;
++	}
+ 	chdir("/");
+ 	umask(S_IWGRP|S_IWOTH);
+-	iDaemon = 1;
+ 
+ 	logentry("Resuming normal operation.", 0);
+ 
--
cgit v0.9.0.2