|
19 | 19 | *
|
20 | 20 | *
|
21 | 21 | * IDENTIFICATION
|
22 |
| - * $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.33 2007/11/24 21:37:04 tgl Exp $ |
| 22 | + * $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.34 2007/12/12 09:39:54 petere Exp $ |
23 | 23 | *
|
24 | 24 | *-------------------------------------------------------------------------
|
25 | 25 | */
|
@@ -484,11 +484,35 @@ pgarch_archiveXlog(char *xlog)
|
484 | 484 | * Per the Single Unix Spec, shells report exit status > 128 when a
|
485 | 485 | * called command died on a signal.
|
486 | 486 | */
|
487 |
| -boolsignaled=WIFSIGNALED(rc)||WEXITSTATUS(rc)>128; |
| 487 | +intlev=(WIFSIGNALED(rc)||WEXITSTATUS(rc)>128) ?FATAL :LOG; |
488 | 488 |
|
489 |
| -ereport(signaled ?FATAL :LOG, |
490 |
| -(errmsg("archive command \"%s\" failed: return code %d", |
491 |
| -xlogarchcmd,rc))); |
| 489 | +if (WIFEXITED(rc)) |
| 490 | +{ |
| 491 | +ereport(lev, |
| 492 | +(errmsg("archive command failed with exit code %d",WEXITSTATUS(rc)), |
| 493 | +errdetail("The failed archive command was: %s",xlogarchcmd))); |
| 494 | +} |
| 495 | +elseif (WIFSIGNALED(rc)) |
| 496 | +{ |
| 497 | +ereport(lev, ( |
| 498 | +#if defined(WIN32) |
| 499 | +errmsg("archive command was terminated by exception 0x%X",WTERMSIG(rc)), |
| 500 | +errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value."), |
| 501 | +#elif defined(HAVE_DECL_SYS_SIGLIST)&&HAVE_DECL_SYS_SIGLIST |
| 502 | +errmsg("archive command was terminated by signal %d: %s", |
| 503 | +WTERMSIG(rc), |
| 504 | +WTERMSIG(rc)<NSIG ?sys_siglist[WTERMSIG(rc)] :"(unknown)"), |
| 505 | +#else |
| 506 | +errmsg("archive command was terminated by signal %d",WTERMSIG(exitstatus)), |
| 507 | +#endif |
| 508 | +errdetail("The failed archive command was: %s",xlogarchcmd))); |
| 509 | +} |
| 510 | +else |
| 511 | +{ |
| 512 | +ereport(lev, |
| 513 | +(errmsg("archive command exited with unrecognized status %d",rc), |
| 514 | +errdetail("The failed archive command was: %s",xlogarchcmd))); |
| 515 | +} |
492 | 516 |
|
493 | 517 | return false;
|
494 | 518 | }
|
|