From 3bbff16c6d34c905fab8fcb792c8606ea356e2a8 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Thu, 21 Feb 2013 19:34:47 +0000 Subject: [PATCH 1/1] Unix CM: Catch ICL initialisation failures If afs_icl_CreateLog fails, don't still call afS_icl_CreateSet. If afs_icl_CreateSetWithFlags fails, don't ignore its error code. Caught by clang-analyzer Change-Id: I245f4391bbbf183492e8c13fb8f091b339cea80a Reviewed-on: http://gerrit.openafs.org/9203 Reviewed-by: Derrick Brashear Tested-by: BuildBot Reviewed-by: Jeffrey Altman --- src/afs/afs_icl.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/afs/afs_icl.c b/src/afs/afs_icl.c index 113703a..60520e1 100644 --- a/src/afs/afs_icl.c +++ b/src/afs/afs_icl.c @@ -83,14 +83,17 @@ afs_icl_InitLogs(void) /* initialize the ICL system */ code = afs_icl_CreateLog("cmfx", 60 * 1024, &logp); - if (code == 0) - code = - afs_icl_CreateSetWithFlags("cm", logp, NULL, - ICL_CRSET_FLAG_DEFAULT_OFF, - &afs_iclSetp); - code = - afs_icl_CreateSet("cmlongterm", logp, NULL, - &afs_iclLongTermSetp); + if (code) + return code; + + code = afs_icl_CreateSetWithFlags("cm", logp, NULL, + ICL_CRSET_FLAG_DEFAULT_OFF, + &afs_iclSetp); + if (code) + return code; + + code = afs_icl_CreateSet("cmlongterm", logp, NULL, + &afs_iclLongTermSetp); return code; } -- 1.9.4