diff --git a/iprconfig.c b/iprconfig.c index 6d721e8..8c9133b 100644 --- a/iprconfig.c +++ b/iprconfig.c @@ -2501,19 +2501,23 @@ int get_drive_phy_loc_with_ses_phy_loc(struct ipr_dev *ses, struct drive_elem_de char unit_phy_loc[PHYSICAL_LOCATION_LENGTH+1]; ipr_strncpy_0(buffer, (char *)drive_data->dev_elem[slot_id].disk_physical_loc, DISK_PHY_LOC_LENGTH); - if (strlen(ses->physical_location) && !strlen(buffer)) { + if (strlen(ses->physical_location)) { + if (strlen(buffer)) { ipr_strncpy_0(unit_phy_loc, ses->physical_location, PHYSICAL_LOCATION_LENGTH); first_hyphen = strchr(unit_phy_loc, '-'); *first_hyphen = '\0'; sprintf(buf, "%s-%s", unit_phy_loc, buffer); } + else + sprintf(buf, "%s", "\0"); + } else if (strlen(buffer)) { ipr_strncpy_0(unit_phy_loc, ses->ioa->physical_location, PHYSICAL_LOCATION_LENGTH); first_hyphen = strchr(unit_phy_loc, '-'); *first_hyphen = '\0'; sprintf(buf, "%s-%s", unit_phy_loc, buffer); } - else + else sprintf(buf, "%s", "\0"); return 0;