Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit83f4e80

Browse files
author
Michael Paquier
committed
Always return an error in case of incorrect backup mode
Some code paths allowed an invalid backup mode to be passed, somethingrather crazy as they directly depended on that...
1 parent9ecd5ac commit83f4e80

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

‎catalog.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ catalog_read_ini(const char *path)
492492

493493
if (backup_mode)
494494
{
495-
backup->backup_mode=parse_backup_mode(backup_mode,WARNING);
495+
backup->backup_mode=parse_backup_mode(backup_mode);
496496
free(backup_mode);
497497
}
498498

@@ -545,12 +545,14 @@ catalog_read_ini(const char *path)
545545
}
546546

547547
BackupMode
548-
parse_backup_mode(constchar*value,intelevel)
548+
parse_backup_mode(constchar*value)
549549
{
550550
constchar*v=value;
551551
size_tlen;
552552

553-
while (IsSpace(*v)) {v++; }
553+
/* Skip all spaces detected */
554+
while (IsSpace(*v))
555+
v++;
554556
len=strlen(v);
555557

556558
if (len>0&&pg_strncasecmp("full",v,len)==0)
@@ -560,7 +562,8 @@ parse_backup_mode(const char *value, int elevel)
560562
elseif (len>0&&pg_strncasecmp("archive",v,len)==0)
561563
returnBACKUP_MODE_ARCHIVE;
562564

563-
elog(elevel,_("invalid backup-mode \"%s\""),value);
565+
/* Backup mode is invalid, so leave with an error */
566+
elog(ERROR_ARGS,_("invalid backup-mode \"%s\""),value);
564567
returnBACKUP_MODE_INVALID;
565568
}
566569

‎pg_rman.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,5 +330,5 @@ if(!IsValidTime(tm)){
330330
staticvoid
331331
opt_backup_mode(pgut_option*opt,constchar*arg)
332332
{
333-
current.backup_mode=parse_backup_mode(arg,ERROR_ARGS);
333+
current.backup_mode=parse_backup_mode(arg);
334334
}

‎pg_rman.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ extern const char *pgdata_exclude[];
230230

231231
/* in backup.c */
232232
externintdo_backup(pgBackupOptionbkupopt);
233-
externBackupModeparse_backup_mode(constchar*value,intelevel);
233+
externBackupModeparse_backup_mode(constchar*value);
234234
externvoidcheck_server_version(void);
235235
externboolfileExists(constchar*path);
236236

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp