Skip to content

Commit 01fedaf

Browse files
committed
pgpro-2605. Use absolute path of pg_probackup binary in recovery.conf generated by pg_probackup
1 parent 7f81494 commit 01fedaf

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/pg_probackup.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
const char *PROGRAM_VERSION = "2.0.27";
2323
const char *PROGRAM_URL = "https://github.com/postgrespro/pg_probackup";
2424
const char *PROGRAM_EMAIL = "https://github.com/postgrespro/pg_probackup/issues";
25+
const char *PROGRAM_FULL_PATH = NULL;
2526

2627
typedef enum ProbackupSubcmd
2728
{
@@ -201,6 +202,14 @@ main(int argc, char *argv[])
201202
init_config(&instance_config);
202203

203204
PROGRAM_NAME = get_progname(argv[0]);
205+
PROGRAM_FULL_PATH = palloc0(MAXPGPATH);
206+
207+
if (find_my_exec(argv[0],(char *) PROGRAM_FULL_PATH) < 0)
208+
{
209+
fprintf(stderr, _("%s: could not find own program executable\n"), PROGRAM_NAME);
210+
exit(1);
211+
}
212+
204213
set_pglocale_pgservice(argv[0], "pgscripts");
205214

206215
#if PG_VERSION_NUM >= 110000

src/restore.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ create_recovery_conf(time_t backup_id,
796796

797797
fprintf(fp, "restore_command = '%s archive-get -B %s --instance %s "
798798
"--wal-file-path %%p --wal-file-name %%f'\n",
799-
PROGRAM_NAME, backup_path, instance_name);
799+
PROGRAM_FULL_PATH, backup_path, instance_name);
800800

801801
/*
802802
* We've already checked that only one of the four following mutually

src/utils/pgut.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ typedef void (*pgut_atexit_callback)(bool fatal, void *userdata);
2020
* pgut client variables and functions
2121
*/
2222
extern const char *PROGRAM_NAME;
23+
extern const char *PROGRAM_FULL_PATH;
2324
extern const char *PROGRAM_VERSION;
2425
extern const char *PROGRAM_URL;
2526
extern const char *PROGRAM_EMAIL;

0 commit comments

Comments
 (0)