From: Marcio Barbosa Date: Thu, 24 Dec 2015 20:23:23 +0000 (-0300) Subject: viced: do not overwrite possible failure X-Git-Tag: upstream/1.8.0_pre1^2~187 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=6e4f8e55282963a5b2e28c4d90f7a32f5ceb37b0;p=packages%2Fo%2Fopenafs.git viced: do not overwrite possible failure The function ‘hpr_Initialize’ overwrites the code returned by ‘ubik_ClientInit’. As a result, ‘hpr_Initialize’ will not report any failure triggered by ‘ubik_ClientInit’. To fix this problem, store the code returned by ‘rxs_Release’ in a new variable. Only return this code if the function ‘ubik_ClientInit’ worked properly. Otherwise, return the code provided by ‘ubik_ClientInit’. Change-Id: I1820e3cbc2131daace01cec0464e56fd2982a783 Reviewed-on: http://gerrit.openafs.org/12137 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- diff --git a/src/viced/host.c b/src/viced/host.c index 6c54cdc08..e44bdb0ee 100644 --- a/src/viced/host.c +++ b/src/viced/host.c @@ -256,7 +256,7 @@ FreeHT(struct host *entry) afs_int32 hpr_Initialize(struct ubik_client **uclient) { - afs_int32 code; + afs_int32 code, code2; struct rx_connection *serverconns[MAXSERVERS]; struct rx_securityClass *sc; struct afsconf_dir *tdir; @@ -323,7 +323,11 @@ hpr_Initialize(struct ubik_client **uclient) ViceLog(0, ("hpr_Initialize: ubik client init failed. [%d]\n", code)); } afsconf_Close(tdir); - code = rxs_Release(sc); + code2 = rxs_Release(sc); + + if (code == 0) { + code = code2; + } return code; }