Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a49f6ad

Browse files
committed
Add full path in error report for version mismatch of binaries.
1 parent 8ff374c commit a49f6ad

File tree

3 files changed

+36
-19
lines changed

3 files changed

+36
-19
lines changed

src/bin/initdb/initdb.c

+12-6
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.61 2004/10/12 21:54:42 petere Exp $
42+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.62 2004/10/15 04:31:48 momjian Exp $
4343
*
4444
*-------------------------------------------------------------------------
4545
*/
@@ -2268,18 +2268,24 @@ main(int argc, char *argv[])
22682268
if ((ret = find_other_exec(argv[0], "postgres", PG_VERSIONSTR,
22692269
backend_exec)) < 0)
22702270
{
2271+
char full_path[MAXPGPATH];
2272+
2273+
if (find_my_exec(argv[0], full_path) < 0)
2274+
StrNCpy(full_path, progname, MAXPGPATH);
2275+
22712276
if (ret == -1)
22722277
fprintf(stderr,
22732278
_("The program \"postgres\" is needed by %s "
2274-
"but was not found in the same directory as \"%s\".\n"
2279+
"but was not found in the\n"
2280+
"same directory as \"%s\".\n"
22752281
"Check your installation.\n"),
2276-
progname, progname);
2282+
progname, full_path);
22772283
else
22782284
fprintf(stderr,
2279-
_("The program \"postgres\" was found by %s "
2280-
"but was not the same version as \"%s\".\n"
2285+
_("The program \"postgres\" was found by \"%s\"\n"
2286+
"but was not the same version as %s.\n"
22812287
"Check your installation.\n"),
2282-
progname, progname);
2288+
full_path, progname);
22832289
exit(1);
22842290
}
22852291

src/bin/pg_ctl/pg_ctl.c

+12-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.36 2004/10/15 01:36:12 neilc Exp $
7+
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.37 2004/10/15 04:32:14 momjian Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -531,17 +531,22 @@ do_start(void)
531531
if ((ret = find_other_exec(argv0, "postmaster", PM_VERSIONSTR,
532532
postmaster_path)) < 0)
533533
{
534+
char full_path[MAXPGPATH];
535+
536+
if (find_my_exec(argv0, full_path) < 0)
537+
StrNCpy(full_path, progname, MAXPGPATH);
538+
534539
if (ret == -1)
535540
write_stderr(_("The program \"postmaster\" is needed by %s "
536-
"but was not found in the same directory as "
537-
"\"%s\".\n"
541+
"but was not found in the\n"
542+
"same directory as \"%s\".\n"
538543
"Check your installation.\n"),
539-
progname, progname);
544+
progname, full_path);
540545
else
541-
write_stderr(_("The program \"postmaster\" was found by %s "
542-
"but was not the same version as \"%s\".\n"
546+
write_stderr(_("The program \"postmaster\" was found by \"%s\"\n"
547+
"but was not the same version as %s.\n"
543548
"Check your installation.\n"),
544-
progname, progname);
549+
full_path, progname);
545550
exit(1);
546551
}
547552
postgres_path = postmaster_path;

src/bin/pg_dump/pg_dumpall.c

+12-6
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.52 2004/10/06 17:02:02 momjian Exp $
9+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.53 2004/10/15 04:32:28 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -139,18 +139,24 @@ main(int argc, char *argv[])
139139
if ((ret = find_other_exec(argv[0], "pg_dump", PG_VERSIONSTR,
140140
pg_dump_bin)) < 0)
141141
{
142+
char full_path[MAXPGPATH];
143+
144+
if (find_my_exec(argv[0], full_path) < 0)
145+
StrNCpy(full_path, progname, MAXPGPATH);
146+
142147
if (ret == -1)
143148
fprintf(stderr,
144149
_("The program \"pg_dump\" is needed by %s "
145-
"but was not found in the same directory as \"%s\".\n"
150+
"but was not found in the\n"
151+
"same directory as \"%s\".\n"
146152
"Check your installation.\n"),
147-
progname, progname);
153+
progname, full_path);
148154
else
149155
fprintf(stderr,
150-
_("The program \"pg_dump\" was found by %s "
151-
"but was not the same version as \"%s\".\n"
156+
_("The program \"pg_dump\" was found by \"%s\"\n"
157+
"but was not the same version as %s.\n"
152158
"Check your installation.\n"),
153-
progname, progname);
159+
full_path, progname);
154160
exit(1);
155161
}
156162

0 commit comments

Comments
 (0)