Skip to content

Commit 9f944f0

Browse files
committed
Adjust find_my_exec/find_other_exec() so that the return parameter is
last, not first. This fits our style better.
1 parent 550735c commit 9f944f0

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.386 2004/05/13 22:45:02 momjian Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.387 2004/05/14 17:04:44 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -693,13 +693,13 @@ PostmasterMain(int argc, char *argv[])
693693
/*
694694
* On some systems our dynloader code needs the executable's pathname.
695695
*/
696-
if (find_my_exec(my_exec_path, argv[0]) < 0)
696+
if (find_my_exec(argv[0], my_exec_path) < 0)
697697
ereport(FATAL,
698698
(errmsg("%s: could not locate my own executable path",
699699
progname)));
700700

701701
#ifdef EXEC_BACKEND
702-
if (find_other_exec(postgres_exec_path, argv[0], "postgres", PG_VERSIONSTR) < 0)
702+
if (find_other_exec(argv[0], "postgres", PG_VERSIONSTR, postgres_exec_path) < 0)
703703
ereport(FATAL,
704704
(errmsg("%s: could not locate postgres executable or non-matching version",
705705
progname)));

src/backend/tcop/postgres.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.405 2004/05/13 22:45:03 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.406 2004/05/14 17:04:45 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -2648,7 +2648,7 @@ PostgresMain(int argc, char *argv[], const char *username)
26482648
/*
26492649
* On some systems our dynloader code needs the executable's pathname.
26502650
*/
2651-
if (strlen(my_exec_path) == 0 && find_my_exec(my_exec_path, argv[0]) < 0)
2651+
if (strlen(my_exec_path) == 0 && find_my_exec(argv[0], my_exec_path) < 0)
26522652
ereport(FATAL,
26532653
(errmsg("%s: could not locate postgres executable",
26542654
argv[0])));

src/bin/initdb/initdb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* Portions Copyright (c) 1994, Regents of the University of California
4040
* Portions taken from FreeBSD.
4141
*
42-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.28 2004/05/12 13:38:42 momjian Exp $
42+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.29 2004/05/14 17:04:46 momjian Exp $
4343
*
4444
*-------------------------------------------------------------------------
4545
*/
@@ -1932,8 +1932,8 @@ main(int argc, char *argv[])
19321932
sprintf(pgdenv, "PGDATA=%s", pg_data);
19331933
putenv(pgdenv);
19341934

1935-
if ((ret = find_other_exec(backendbin, argv[0], "postgres",
1936-
PG_VERSIONSTR)) < 0)
1935+
if ((ret = find_other_exec(argv[0], "postgres", PG_VERSIONSTR,
1936+
backendbin)) < 0)
19371937
{
19381938
if (ret == -1)
19391939
fprintf(stderr,

src/bin/pg_dump/pg_dumpall.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
88
*
9-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.32 2004/05/12 13:38:44 momjian Exp $
9+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.33 2004/05/14 17:04:47 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -123,8 +123,8 @@ main(int argc, char *argv[])
123123
}
124124
}
125125

126-
if ((ret = find_other_exec(pg_dump_bin, argv[0], "pg_dump",
127-
PG_VERSIONSTR)) < 0)
126+
if ((ret = find_other_exec(argv[0], "pg_dump", PG_VERSIONSTR,
127+
pg_dump_bin)) < 0)
128128
{
129129
if (ret == -1)
130130
fprintf(stderr,

src/include/port.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.30 2004/05/12 13:38:48 momjian Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.31 2004/05/14 17:04:47 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -28,9 +28,9 @@ extern void canonicalize_path(char *path);
2828
extern const char *get_progname(const char *argv0);
2929

3030
/* Portable way to find binaries */
31-
extern int find_my_exec(char *full_path, const char *argv0);
32-
extern int find_other_exec(char *retpath, const char *argv0,
33-
char const *target, const char *versionstr);
31+
extern int find_my_exec(const char *argv0, char *full_path);
32+
extern int find_other_exec(const char *argv0, char const *target,
33+
const char *versionstr, char *retpath);
3434

3535
#if defined(__CYGWIN__) || defined(WIN32)
3636
#define EXE ".exe"

src/port/exec.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/port/exec.c,v 1.4 2004/05/13 22:45:04 momjian Exp $
10+
* $PostgreSQL: pgsql/src/port/exec.c,v 1.5 2004/05/14 17:04:48 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -177,7 +177,7 @@ validate_exec(char *path)
177177
* non-threaded binaries, not in library routines.
178178
*/
179179
int
180-
find_my_exec(char *full_path, const char *argv0)
180+
find_my_exec(const char *argv0, char *full_path)
181181
{
182182
char buf[MAXPGPATH + 2];
183183
char *p;
@@ -272,14 +272,14 @@ find_my_exec(char *full_path, const char *argv0)
272272
* Find our binary directory, then make sure the "target" executable
273273
* is the proper version.
274274
*/
275-
int find_other_exec(char *retpath, const char *argv0,
276-
char const *target, const char *versionstr)
275+
int find_other_exec(const char *argv0, char const *target,
276+
const char *versionstr, char *retpath)
277277
{
278278
char cmd[MAXPGPATH];
279279
char line[100];
280280
FILE *pgver;
281281

282-
if (find_my_exec(retpath, argv0) < 0)
282+
if (find_my_exec(argv0, retpath) < 0)
283283
return -1;
284284

285285
/* Trim off program name and keep just directory */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy