1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-12-12 11:45:24 +02:00

Rename dubious pg_probackup variable into PROGRAM_NAME_FULL

This commit is contained in:
Arthur Zakirov 2019-06-20 11:48:06 +03:00
parent 66ad28201e
commit e163c4504c
3 changed files with 13 additions and 13 deletions

View File

@ -20,7 +20,9 @@
#include "utils/thread.h" #include "utils/thread.h"
#include <time.h> #include <time.h>
const char *PROGRAM_NAME = NULL; const char *PROGRAM_NAME = NULL; /* PROGRAM_NAME_FULL without .exe suffix
* if any */
const char *PROGRAM_NAME_FULL = NULL;
const char *PROGRAM_FULL_PATH = NULL; const char *PROGRAM_FULL_PATH = NULL;
const char *PROGRAM_URL = "https://github.com/postgrespro/pg_probackup"; const char *PROGRAM_URL = "https://github.com/postgrespro/pg_probackup";
const char *PROGRAM_EMAIL = "https://github.com/postgrespro/pg_probackup/issues"; const char *PROGRAM_EMAIL = "https://github.com/postgrespro/pg_probackup/issues";
@ -45,8 +47,6 @@ typedef enum ProbackupSubcmd
} ProbackupSubcmd; } ProbackupSubcmd;
char *pg_probackup; /* Program name (argv[0]) */
/* directory options */ /* directory options */
char *backup_path = NULL; char *backup_path = NULL;
/* /*
@ -235,7 +235,7 @@ main(int argc, char *argv[])
struct stat stat_buf; struct stat stat_buf;
int rc; int rc;
pg_probackup = argv[0]; PROGRAM_NAME_FULL = argv[0];
/* Initialize current backup */ /* Initialize current backup */
pgBackupInit(&current); pgBackupInit(&current);

View File

@ -36,6 +36,7 @@
/* pgut client variables and full path */ /* pgut client variables and full path */
extern const char *PROGRAM_NAME; extern const char *PROGRAM_NAME;
extern const char *PROGRAM_NAME_FULL;
extern const char *PROGRAM_FULL_PATH; extern const char *PROGRAM_FULL_PATH;
extern const char *PROGRAM_URL; extern const char *PROGRAM_URL;
extern const char *PROGRAM_EMAIL; extern const char *PROGRAM_EMAIL;
@ -412,7 +413,6 @@ typedef struct BackupPageHeader
#define IsSshProtocol() (instance_config.remote.host && strcmp(instance_config.remote.proto, "ssh") == 0) #define IsSshProtocol() (instance_config.remote.host && strcmp(instance_config.remote.proto, "ssh") == 0)
/* directory options */ /* directory options */
extern char *pg_probackup;
extern char *backup_path; extern char *backup_path;
extern char backup_instance_path[MAXPGPATH]; extern char backup_instance_path[MAXPGPATH];
extern char arclog_path[MAXPGPATH]; extern char arclog_path[MAXPGPATH];

View File

@ -91,7 +91,7 @@ bool launch_agent(void)
ssh_argc = 0; ssh_argc = 0;
#ifdef WIN32 #ifdef WIN32
ssh_argv[ssh_argc++] = pg_probackup; ssh_argv[ssh_argc++] = PROGRAM_NAME_FULL;
ssh_argv[ssh_argc++] = "ssh"; ssh_argv[ssh_argc++] = "ssh";
ssh_argc += 2; /* reserve space for pipe descriptors */ ssh_argc += 2; /* reserve space for pipe descriptors */
#endif #endif
@ -129,7 +129,7 @@ bool launch_agent(void)
if (instance_config.remote.path) if (instance_config.remote.path)
{ {
char const* probackup = pg_probackup; char const* probackup = PROGRAM_NAME_FULL;
char* sep = strrchr(probackup, '/'); char* sep = strrchr(probackup, '/');
if (sep != NULL) { if (sep != NULL) {
probackup = sep + 1; probackup = sep + 1;
@ -141,14 +141,14 @@ bool launch_agent(void)
probackup = sep + 1; probackup = sep + 1;
} }
} }
if (needs_quotes(instance_config.remote.path) || needs_quotes(pg_probackup)) if (needs_quotes(instance_config.remote.path) || needs_quotes(PROGRAM_NAME_FULL))
snprintf(cmd, sizeof(cmd), "\"%s\\%s\" agent %s", snprintf(cmd, sizeof(cmd), "\"%s\\%s\" agent %s",
instance_config.remote.path, probackup, PROGRAM_VERSION); instance_config.remote.path, probackup, PROGRAM_VERSION);
else else
snprintf(cmd, sizeof(cmd), "%s\\%s agent %s", snprintf(cmd, sizeof(cmd), "%s\\%s agent %s",
instance_config.remote.path, probackup, PROGRAM_VERSION); instance_config.remote.path, probackup, PROGRAM_VERSION);
#else #else
if (needs_quotes(instance_config.remote.path) || needs_quotes(pg_probackup)) if (needs_quotes(instance_config.remote.path) || needs_quotes(PROGRAM_NAME_FULL))
snprintf(cmd, sizeof(cmd), "\"%s/%s\" agent %s", snprintf(cmd, sizeof(cmd), "\"%s/%s\" agent %s",
instance_config.remote.path, probackup, PROGRAM_VERSION); instance_config.remote.path, probackup, PROGRAM_VERSION);
else else
@ -156,10 +156,10 @@ bool launch_agent(void)
instance_config.remote.path, probackup, PROGRAM_VERSION); instance_config.remote.path, probackup, PROGRAM_VERSION);
#endif #endif
} else { } else {
if (needs_quotes(pg_probackup)) if (needs_quotes(PROGRAM_NAME_FULL))
snprintf(cmd, sizeof(cmd), "\"%s\" agent %s", pg_probackup, PROGRAM_VERSION); snprintf(cmd, sizeof(cmd), "\"%s\" agent %s", PROGRAM_NAME_FULL, PROGRAM_VERSION);
else else
snprintf(cmd, sizeof(cmd), "%s agent %s", pg_probackup, PROGRAM_VERSION); snprintf(cmd, sizeof(cmd), "%s agent %s", PROGRAM_NAME_FULL, PROGRAM_VERSION);
} }
#ifdef WIN32 #ifdef WIN32