File tree 1 file changed +12
-5
lines changed
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 4
4
* Revisions by Christopher B. Browne, Liberty RMS
5
5
* Win32 Service code added by Dave Page
6
6
*
7
- * $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.c,v 1.29 2005/01/26 22:25:13 tgl Exp $
7
+ * $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.c,v 1.30 2005/04/03 00:01:51 tgl Exp $
8
8
*/
9
9
10
10
#include "postgres_fe.h"
18
18
#ifdef WIN32
19
19
#include <windows.h>
20
20
#endif
21
+ #include <sys/stat.h>
22
+ #include <fcntl.h>
21
23
22
24
#include "pg_autovacuum.h"
23
25
@@ -186,13 +188,13 @@ log_entry(const char *logentry, int level)
186
188
* Function used to detach the pg_autovacuum daemon from the tty and go into
187
189
* the background.
188
190
*
189
- * This code is mostly ripped directly from pm_dameonize in postmaster.c with
190
- * unneeded code removed.
191
+ * This code is ripped directly from pmdaemonize in postmaster.c.
191
192
*/
192
193
#ifndef WIN32
193
194
static void
194
195
daemonize (void )
195
196
{
197
+ int i ;
196
198
pid_t pid ;
197
199
198
200
pid = fork ();
@@ -209,7 +211,8 @@ daemonize(void)
209
211
}
210
212
211
213
/* GH: If there's no setsid(), we hopefully don't need silent mode.
212
- * Until there's a better solution. */
214
+ * Until there's a better solution.
215
+ */
213
216
#ifdef HAVE_SETSID
214
217
if (setsid () < 0 )
215
218
{
@@ -218,7 +221,11 @@ daemonize(void)
218
221
_exit (1 );
219
222
}
220
223
#endif
221
-
224
+ i = open (NULL_DEV , O_RDWR );
225
+ dup2 (i , 0 );
226
+ dup2 (i , 1 );
227
+ dup2 (i , 2 );
228
+ close (i );
222
229
}
223
230
#endif /* WIN32 */
224
231
You can’t perform that action at this time.
0 commit comments