From 6e4f8e55282963a5b2e28c4d90f7a32f5ceb37b0 Mon Sep 17 00:00:00 2001 From: Marcio Barbosa Date: Thu, 24 Dec 2015 17:23:23 -0300 Subject: [PATCH] viced: do not overwrite possible failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/viced/host.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/viced/host.c b/src/viced/host.c index 6c54cdc..e44bdb0 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; } -- 1.9.4