X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=lib%2Fpaxlib.h;h=d4251d14cd126892649916716a9470c21ab54ad8;hb=4aa85f09e755fc827cd5ab6225f20c83cd42245d;hp=d0ba45ba1e66ac216d2fdfc96c1adae2a67da087;hpb=eb3ba7cb06fdd0f8627b8f117d8453e297e18b64;p=debian%2Ftar diff --git a/lib/paxlib.h b/lib/paxlib.h index d0ba45ba..d4251d14 100644 --- a/lib/paxlib.h +++ b/lib/paxlib.h @@ -32,6 +32,8 @@ #define PAXEXIT_DIFFERS 1 #define PAXEXIT_FAILURE 2 +extern void (*error_hook) (void); + /* Both WARN and ERROR write a message on stderr and continue processing, however ERROR manages so tar will exit unsuccessfully. FATAL_ERROR writes a message on stderr and aborts immediately, with another message @@ -41,13 +43,31 @@ is zero when the error is not being detected by the system. */ #define WARN(Args) \ - error Args + do { if (error_hook) error_hook (); error Args; } while (0) #define ERROR(Args) \ - (error Args, exit_status = PAXEXIT_FAILURE) + do \ + { \ + if (error_hook) error_hook (); \ + error Args; \ + exit_status = PAXEXIT_FAILURE; \ + } \ + while (0) #define FATAL_ERROR(Args) \ - (error Args, fatal_exit ()) + do \ + { \ + if (error_hook) error_hook (); \ + error Args; \ + fatal_exit (); \ + } \ + while (0) #define USAGE_ERROR(Args) \ - (error Args, usage (PAXEXIT_FAILURE)) + do \ + { \ + if (error_hook) error_hook (); \ + error Args; \ + usage (PAXEXIT_FAILURE); \ + } \ + while (0) extern int exit_status;