Skip to content

Commit 3661d1d

Browse files
committed
This patch fixes the find_my_exec code for pgstat backends. Required for
TZ stuff (and possibly others) to work in the pgstat backends. Magnus Hagander
1 parent dc39937 commit 3661d1d

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

src/backend/main/main.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.80 2004/05/19 18:58:44 momjian Exp $
16+
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.81 2004/05/24 02:47:44 momjian Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -278,22 +278,20 @@ main(int argc, char *argv[])
278278
}
279279

280280
/*
281-
* If the first argument is "-statBuf", then invoke pgstat_main. Note
282-
* we remove "-statBuf" from the arguments passed on to pgstat_main.
281+
* If the first argument is "-statBuf", then invoke pgstat_main.
283282
*/
284283
if (argc > 1 && strcmp(argv[1], "-statBuf") == 0)
285284
{
286-
pgstat_main(argc - 2, argv + 2);
285+
pgstat_main(argc , argv);
287286
exit(0);
288287
}
289288

290289
/*
291-
* If the first argument is "-statCol", then invoke pgstat_mainChild. Note
292-
* we remove "-statCol" from the arguments passed on to pgstat_mainChild.
290+
* If the first argument is "-statCol", then invoke pgstat_mainChild.
293291
*/
294292
if (argc > 1 && strcmp(argv[1], "-statCol") == 0)
295293
{
296-
pgstat_mainChild(argc - 2, argv + 2);
294+
pgstat_mainChild(argc, argv);
297295
exit(0);
298296
}
299297
#endif

src/backend/postmaster/pgstat.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
1515
*
16-
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.70 2004/05/18 03:36:30 momjian Exp $
16+
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.71 2004/05/24 02:47:47 momjian Exp $
1717
* ----------
1818
*/
1919
#include "postgres.h"
@@ -520,8 +520,16 @@ pgstat_forkexec(STATS_PROCESS_TYPE procType)
520520
static void
521521
pgstat_parseArgs(PGSTAT_FORK_ARGS)
522522
{
523-
Assert(argc == 12);
524-
argc = 0;
523+
Assert(argc == 14);
524+
525+
if (find_my_exec(argv[0], my_exec_path) < 0)
526+
elog(FATAL,
527+
gettext("%s: could not locate my own executable path"),
528+
argv[0]);
529+
530+
get_pkglib_path(my_exec_path, pkglib_path);
531+
532+
argc = 2;
525533
pgStatSock = atoi(argv[argc++]);
526534
pgStatPmPipe[0] = atoi(argv[argc++]);
527535
pgStatPmPipe[1] = atoi(argv[argc++]);

0 commit comments

Comments
 (0)