diff --git a/src/pg_probackup.c b/src/pg_probackup.c index 67db3bb1..24ba2759 100644 --- a/src/pg_probackup.c +++ b/src/pg_probackup.c @@ -22,6 +22,7 @@ const char *PROGRAM_VERSION = "2.0.27"; const char *PROGRAM_URL = "https://github.com/postgrespro/pg_probackup"; const char *PROGRAM_EMAIL = "https://github.com/postgrespro/pg_probackup/issues"; +const char *PROGRAM_FULL_PATH = NULL; typedef enum ProbackupSubcmd { @@ -201,6 +202,14 @@ main(int argc, char *argv[]) init_config(&instance_config); PROGRAM_NAME = get_progname(argv[0]); + PROGRAM_FULL_PATH = palloc0(MAXPGPATH); + + if (find_my_exec(argv[0],(char *) PROGRAM_FULL_PATH) < 0) + { + fprintf(stderr, _("%s: could not find own program executable\n"), PROGRAM_NAME); + exit(1); + } + set_pglocale_pgservice(argv[0], "pgscripts"); #if PG_VERSION_NUM >= 110000 diff --git a/src/restore.c b/src/restore.c index 7efd433a..bd8f5b72 100644 --- a/src/restore.c +++ b/src/restore.c @@ -796,7 +796,7 @@ create_recovery_conf(time_t backup_id, fprintf(fp, "restore_command = '%s archive-get -B %s --instance %s " "--wal-file-path %%p --wal-file-name %%f'\n", - PROGRAM_NAME, backup_path, instance_name); + PROGRAM_FULL_PATH, backup_path, instance_name); /* * We've already checked that only one of the four following mutually diff --git a/src/utils/pgut.h b/src/utils/pgut.h index bde5dee1..41a261d2 100644 --- a/src/utils/pgut.h +++ b/src/utils/pgut.h @@ -20,6 +20,7 @@ typedef void (*pgut_atexit_callback)(bool fatal, void *userdata); * pgut client variables and functions */ extern const char *PROGRAM_NAME; +extern const char *PROGRAM_FULL_PATH; extern const char *PROGRAM_VERSION; extern const char *PROGRAM_URL; extern const char *PROGRAM_EMAIL;