diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index c9783560e13fe1c3b4e8721b42612653445d1f29..1e558d5a6393ce092976881ec1035fda31c0d7d4 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -37,7 +37,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.386 2004/05/13 22:45:02 momjian Exp $
+ *	  $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.387 2004/05/14 17:04:44 momjian Exp $
  *
  * NOTES
  *
@@ -693,13 +693,13 @@ PostmasterMain(int argc, char *argv[])
 	/*
 	 * On some systems our dynloader code needs the executable's pathname.
 	 */
-	if (find_my_exec(my_exec_path, argv[0]) < 0)
+	if (find_my_exec(argv[0], my_exec_path) < 0)
 		ereport(FATAL,
 				(errmsg("%s: could not locate my own executable path",
 						progname)));
 
 #ifdef EXEC_BACKEND
-	if (find_other_exec(postgres_exec_path, argv[0], "postgres", PG_VERSIONSTR) < 0)
+	if (find_other_exec(argv[0], "postgres", PG_VERSIONSTR, postgres_exec_path) < 0)
 		ereport(FATAL,
 				(errmsg("%s: could not locate postgres executable or non-matching version",
 						progname)));
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 97c4d1dde166ab543b0283b39c32d522a5621ee1..72750bfa623ac3f181e2870fea3caa2fd7c25c74 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.405 2004/05/13 22:45:03 momjian Exp $
+ *	  $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.406 2004/05/14 17:04:45 momjian Exp $
  *
  * NOTES
  *	  this is the "main" module of the postgres backend and
@@ -2648,7 +2648,7 @@ PostgresMain(int argc, char *argv[], const char *username)
 		/*
 		 * On some systems our dynloader code needs the executable's pathname.
 		 */
-		if (strlen(my_exec_path) == 0 && find_my_exec(my_exec_path, argv[0]) < 0)
+		if (strlen(my_exec_path) == 0 && find_my_exec(argv[0], my_exec_path) < 0)
 			ereport(FATAL,
 					(errmsg("%s: could not locate postgres executable",
 							argv[0])));
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index c7ebb60f03dc5340cc1b41241ed66f03d9867c17..90fdc3664d6ff81455bc0a8b9668c8476c22b73a 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -39,7 +39,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  * Portions taken from FreeBSD.
  *
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.28 2004/05/12 13:38:42 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.29 2004/05/14 17:04:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1932,8 +1932,8 @@ main(int argc, char *argv[])
 	sprintf(pgdenv, "PGDATA=%s", pg_data);
 	putenv(pgdenv);
 
-	if ((ret = find_other_exec(backendbin, argv[0], "postgres",
-						   PG_VERSIONSTR)) < 0)
+	if ((ret = find_other_exec(argv[0], "postgres", PG_VERSIONSTR,
+							   backendbin)) < 0)
 	{
 		if (ret == -1)
 			fprintf(stderr,
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index cac837865e327b8298097c4130fbb231a6d75896..102e34d66c9899306b6c6804f69030232e858372 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  *
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.32 2004/05/12 13:38:44 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.33 2004/05/14 17:04:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -123,8 +123,8 @@ main(int argc, char *argv[])
 		}
 	}
 
-	if ((ret = find_other_exec(pg_dump_bin, argv[0], "pg_dump",
-						   PG_VERSIONSTR)) < 0)
+	if ((ret = find_other_exec(argv[0], "pg_dump", PG_VERSIONSTR,
+							   pg_dump_bin)) < 0)
 	{
 		if (ret == -1)
 			fprintf(stderr,
diff --git a/src/include/port.h b/src/include/port.h
index a037ac1f5f4099186a9711409c3a387be88eead0..ca184bd98c9577de9b1db4239899760a8846d9e3 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/port.h,v 1.30 2004/05/12 13:38:48 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/port.h,v 1.31 2004/05/14 17:04:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -28,9 +28,9 @@ extern void canonicalize_path(char *path);
 extern const char *get_progname(const char *argv0);
 
 /* Portable way to find binaries */
-extern int find_my_exec(char *full_path, const char *argv0);
-extern int find_other_exec(char *retpath, const char *argv0,
-					   char const *target, const char *versionstr);
+extern int find_my_exec(const char *argv0, char *full_path);
+extern int find_other_exec(const char *argv0, char const *target,
+						   const char *versionstr, char *retpath);
 
 #if defined(__CYGWIN__) || defined(WIN32)
 #define EXE ".exe"
diff --git a/src/port/exec.c b/src/port/exec.c
index 8810184a3777015cb6e097ccc2070316f3121933..102208255198eb1250602c88d5dbe9d44b74ae04 100644
--- a/src/port/exec.c
+++ b/src/port/exec.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/port/exec.c,v 1.4 2004/05/13 22:45:04 momjian Exp $
+ *	  $PostgreSQL: pgsql/src/port/exec.c,v 1.5 2004/05/14 17:04:48 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -177,7 +177,7 @@ validate_exec(char *path)
  * non-threaded binaries, not in library routines.
  */
 int
-find_my_exec(char *full_path, const char *argv0)
+find_my_exec(const char *argv0, char *full_path)
 {
 	char		buf[MAXPGPATH + 2];
 	char	   *p;
@@ -272,14 +272,14 @@ find_my_exec(char *full_path, const char *argv0)
  * Find our binary directory, then make sure the "target" executable
  * is the proper version.
  */
-int find_other_exec(char *retpath, const char *argv0,
-			    char const *target, const char *versionstr)
+int find_other_exec(const char *argv0, char const *target,
+					const char *versionstr, char *retpath)
 {
 	char		cmd[MAXPGPATH];
 	char		line[100];
 	FILE	   *pgver;
 
-	if (find_my_exec(retpath, argv0) < 0)
+	if (find_my_exec(argv0, retpath) < 0)
 		return -1;
 
 	/* Trim off program name and keep just directory */