Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit503edbd

Browse files
committed
Put back code mistakenly removed from copy of postmaster's
daemonize routine, namely forcing stdin/stdout/stderr to pointto /dev/null. Per Karl Denninger.
1 parentdfd33e2 commit503edbd

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

‎contrib/pg_autovacuum/pg_autovacuum.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Revisions by Christopher B. Browne, Liberty RMS
55
* Win32 Service code added by Dave Page
66
*
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 $
88
*/
99

1010
#include"postgres_fe.h"
@@ -18,6 +18,8 @@
1818
#ifdefWIN32
1919
#include<windows.h>
2020
#endif
21+
#include<sys/stat.h>
22+
#include<fcntl.h>
2123

2224
#include"pg_autovacuum.h"
2325

@@ -186,13 +188,13 @@ log_entry(const char *logentry, int level)
186188
* Function used to detach the pg_autovacuum daemon from the tty and go into
187189
* the background.
188190
*
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.
191192
*/
192193
#ifndefWIN32
193194
staticvoid
194195
daemonize(void)
195196
{
197+
inti;
196198
pid_tpid;
197199

198200
pid=fork();
@@ -209,7 +211,8 @@ daemonize(void)
209211
}
210212

211213
/* 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+
*/
213216
#ifdefHAVE_SETSID
214217
if (setsid()<0)
215218
{
@@ -218,7 +221,11 @@ daemonize(void)
218221
_exit(1);
219222
}
220223
#endif
221-
224+
i=open(NULL_DEV,O_RDWR);
225+
dup2(i,0);
226+
dup2(i,1);
227+
dup2(i,2);
228+
close(i);
222229
}
223230
#endif/* WIN32 */
224231

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp