Mercurial > illumos > illumos-gate
changeset 10057:6f1fb533f14e
6383235 smf_maintain_instance() shouldn't fail with SCF_ERROR_DELETED
author | Gary Mills <mills@cc.umanitoba.ca> |
---|---|
date | Wed, 08 Jul 2009 11:30:42 -0700 |
parents | 9f478b0e65da |
children | 735e53d134d0 |
files | usr/src/lib/libscf/common/midlevel.c |
diffstat | 1 files changed, 16 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/lib/libscf/common/midlevel.c Wed Jul 08 08:44:27 2009 -0600 +++ b/usr/src/lib/libscf/common/midlevel.c Wed Jul 08 11:30:42 2009 -0700 @@ -946,10 +946,21 @@ if (inst != NULL) { if (scf_handle_decode_fmri(h, fmri, NULL, NULL, inst, NULL, - NULL, SCF_DECODE_FMRI_EXACT) == 0) + NULL, SCF_DECODE_FMRI_EXACT) == 0) { ret = set_inst_action_inst(inst, action); - else if (scf_error() == SCF_ERROR_CONSTRAINT_VIOLATED) - (void) scf_set_error(SCF_ERROR_INVALID_ARGUMENT); + if (ret == -1 && scf_error() == SCF_ERROR_DELETED) + (void) scf_set_error(SCF_ERROR_NOT_FOUND); + } else { + switch (scf_error()) { + case SCF_ERROR_CONSTRAINT_VIOLATED: + (void) scf_set_error( + SCF_ERROR_INVALID_ARGUMENT); + break; + case SCF_ERROR_DELETED: + (void) scf_set_error(SCF_ERROR_NOT_FOUND); + break; + } + } scf_instance_destroy(inst); } @@ -1106,6 +1117,8 @@ out: scf_instance_destroy(inst); scf_handle_destroy(h); + if (ret == -1 && scf_error() == SCF_ERROR_DELETED) + (void) scf_set_error(SCF_ERROR_NOT_FOUND); return (ret); }