It's a common idiom:
    
        Error *local_err = NULL;
        ....
        foo(&local_err);
        ...
        if (local_err) {
            error_propagate(errp, local_err);
            return;
        }
    
    Unfortunately it means that call to foo(&local_err) will
    not abort even if errp is set to error_abort.
    
    Instead, we get an abort at error_propagate which is too late,
    that is, the quality of the stack trace is degraded in that it no longer
    pinpoints the actual cause of failure.
    
    To fix, add an API to check errp and set local_err to error_abort
    if errp is error_abort.

This is out of RFC but I'm still not converting all users:
let's merge these patches, then I'll convert all users
on top.

Changes from v1:
    Check Error * pointer, not the class, as suggested by Eric.
    Extend commit log messages with explanation by Eric.

Michael S. Tsirkin (3):
  error: don't rely on pointer comparisons
  error: allow local errors to trigger abort
  block/nfs: switch to error_init_local

 include/qapi/error.h |  5 +++++
 block/nfs.c          |  2 +-
 util/error.c         | 22 +++++++++++++++++-----
 3 files changed, 23 insertions(+), 6 deletions(-)

-- 
MST


Reply via email to