You've already forked pg_probackup
mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2026-06-21 01:34:15 +02:00
[Issue #224] nitpicking
This commit is contained in:
+3
-3
@@ -336,12 +336,12 @@ pgBackupGetBackupMode(pgBackup *backup, bool show_color)
|
||||
if (show_color)
|
||||
{
|
||||
/* color the Backup mode */
|
||||
char *mode = pgut_malloc(25); /* leaking memory here */
|
||||
char *mode = pgut_malloc(24); /* leaking memory here */
|
||||
|
||||
if (backup->backup_mode == BACKUP_MODE_FULL)
|
||||
snprintf(mode, 25, "%s%s%s", TC_GREEN_BOLD, backupModes[backup->backup_mode], TC_RESET);
|
||||
snprintf(mode, 24, "%s%s%s", TC_GREEN_BOLD, backupModes[backup->backup_mode], TC_RESET);
|
||||
else
|
||||
snprintf(mode, 25, "%s%s%s", TC_BLUE_BOLD, backupModes[backup->backup_mode], TC_RESET);
|
||||
snprintf(mode, 24, "%s%s%s", TC_BLUE_BOLD, backupModes[backup->backup_mode], TC_RESET);
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
@@ -111,6 +111,7 @@ extern const char *PROGRAM_EMAIL;
|
||||
#define XRecOffIsNull(xlrp) \
|
||||
((xlrp) % XLOG_BLCKSZ == 0)
|
||||
|
||||
/* Text Coloring macro */
|
||||
#define TC_LEN 11
|
||||
#define TC_RED "\033[0;31m"
|
||||
#define TC_RED_BOLD "\033[1;31m"
|
||||
|
||||
+2
-2
@@ -522,7 +522,7 @@ status2str_color(BackupStatus status)
|
||||
char *status_str = pgut_malloc(20);
|
||||
|
||||
/* UNKNOWN */
|
||||
if (status < BACKUP_STATUS_INVALID || BACKUP_STATUS_CORRUPT < status)
|
||||
if (status == BACKUP_STATUS_INVALID)
|
||||
snprintf(status_str, 20, "%s%s%s", TC_YELLOW_BOLD, "UNKNOWN", TC_RESET);
|
||||
/* CORRUPT, ERROR and ORPHAN */
|
||||
else if (status == BACKUP_STATUS_CORRUPT || status == BACKUP_STATUS_ERROR ||
|
||||
@@ -532,8 +532,8 @@ status2str_color(BackupStatus status)
|
||||
else if (status == BACKUP_STATUS_MERGING || status == BACKUP_STATUS_MERGED ||
|
||||
status == BACKUP_STATUS_DELETING || status == BACKUP_STATUS_DELETED)
|
||||
snprintf(status_str, 20, "%s%s%s", TC_YELLOW_BOLD, statusName[status], TC_RESET);
|
||||
/* OK and DONE */
|
||||
else
|
||||
/* OK and DONE */
|
||||
snprintf(status_str, 20, "%s%s%s", TC_GREEN_BOLD, statusName[status], TC_RESET);
|
||||
|
||||
return status_str;
|
||||
|
||||
@@ -132,7 +132,6 @@ init_console(void)
|
||||
!isatty(fileno(stdout)))
|
||||
{
|
||||
show_color = false;
|
||||
_dosmaperr(GetLastError());
|
||||
elog(WARNING, "No terminal detected, ignoring '--color' flag");
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user