Unix CM: Catch ICL initialisation failures
authorSimon Wilkinson <sxw@your-file-system.com>
Thu, 21 Feb 2013 19:34:47 +0000 (19:34 +0000)
committerJeffrey Altman <jaltman@your-file-system.com>
Sun, 24 Feb 2013 19:27:01 +0000 (11:27 -0800)
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 <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/afs/afs_icl.c

index 113703a..60520e1 100644 (file)
@@ -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;
 }