Print this page
OS-1576 Sundry uninitialised variables
Reviewed by: Robert Mustacchi <rm@joyent.com>

*** 1119,1129 **** struct zone_devtab ztab; di_prof_t prof = NULL; int err; int retval = -1; zone_iptype_t iptype; ! const char *curr_iptype; if (di_prof_init(devpath, &prof)) { zerror(zlogp, B_TRUE, "failed to initialize profile"); goto cleanup; } --- 1119,1129 ---- struct zone_devtab ztab; di_prof_t prof = NULL; int err; int retval = -1; zone_iptype_t iptype; ! const char *curr_iptype = NULL; if (di_prof_init(devpath, &prof)) { zerror(zlogp, B_TRUE, "failed to initialize profile"); goto cleanup; }
*** 1154,1163 **** --- 1154,1165 ---- break; case ZS_EXCLUSIVE: curr_iptype = "exclusive"; break; } + if (curr_iptype == NULL) + abort(); if (brand_platform_iter_devices(bh, zone_name, mount_one_dev_device_cb, prof, curr_iptype) != 0) { zerror(zlogp, B_TRUE, "failed to add standard device"); goto cleanup;
*** 3192,3202 **** int error = -1; char *privname = NULL; if (ALT_MOUNT(mount_cmd)) { zone_iptype_t iptype; ! const char *curr_iptype; if (zonecfg_get_iptype(snap_hndl, &iptype) != Z_OK) { zerror(zlogp, B_TRUE, "unable to determine ip-type"); return (-1); } --- 3194,3204 ---- int error = -1; char *privname = NULL; if (ALT_MOUNT(mount_cmd)) { zone_iptype_t iptype; ! const char *curr_iptype = NULL; if (zonecfg_get_iptype(snap_hndl, &iptype) != Z_OK) { zerror(zlogp, B_TRUE, "unable to determine ip-type"); return (-1); }
*** 4497,4507 **** char *kzone; FILE *fp = NULL; tsol_zcent_t *zcent = NULL; int match = 0; int doi = 0; ! int flags; zone_iptype_t iptype; if (zone_get_rootpath(zone_name, rootpath, sizeof (rootpath)) != Z_OK) { zerror(zlogp, B_TRUE, "unable to determine zone root"); return (-1); --- 4499,4509 ---- char *kzone; FILE *fp = NULL; tsol_zcent_t *zcent = NULL; int match = 0; int doi = 0; ! int flags = -1; zone_iptype_t iptype; if (zone_get_rootpath(zone_name, rootpath, sizeof (rootpath)) != Z_OK) { zerror(zlogp, B_TRUE, "unable to determine zone root"); return (-1);
*** 4519,4528 **** --- 4521,4532 ---- break; case ZS_EXCLUSIVE: flags = ZCF_NET_EXCL; break; } + if (flags == -1) + abort(); if ((privs = priv_allocset()) == NULL) { zerror(zlogp, B_TRUE, "%s failed", "priv_allocset"); return (-1); }
*** 4870,4879 **** --- 4874,4885 ---- 0) { lofs_discard_mnttab(); return (-1); } break; + default: + abort(); } } write_index_file(zoneid);