From 16b2799150981e9fc134573957d156d560f6d758 Mon Sep 17 00:00:00 2001 From: Jens Remus Date: Mon, 26 Nov 2018 18:10:33 +0100 Subject: [PATCH] zdev: Handle special case in if-case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As preparation for a following commit reorder the path logic in function zfcp_lun_st_get_active_attrib_path(). This then allows to handle subsequent special cases more easily. Additionally it also enhances the readability of the expression. Signed-off-by: Jens Remus Reviewed-by: Peter Oberparleiter Reviewed-by: Fedor Loshakov Reviewed-by: Benjamin Block Signed-off-by: Jan Höppner --- zdev/src/zfcp_lun.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zdev/src/zfcp_lun.c b/zdev/src/zfcp_lun.c index 57801017..f73acf00 100644 --- a/zdev/src/zfcp_lun.c +++ b/zdev/src/zfcp_lun.c @@ -761,10 +761,8 @@ static char *zfcp_lun_st_get_active_attrib_path(struct subtype *st, char *hctl, *devpath, *path; size_t len = strlen(SCSI_ATTR_PREFIX); - if (!starts_with(name, SCSI_ATTR_PREFIX) || - !(name[len] == 0 || name[len] == '/' )) - devpath = path_get_zfcp_lun_dev(dev->devid); - else { + if (starts_with(name, SCSI_ATTR_PREFIX) && + (name[len] == 0 || name[len] == '/')) { hctl = scsi_hctl_from_zfcp_lun_devid(dev->devid); if (!hctl) return NULL; @@ -772,6 +770,8 @@ static char *zfcp_lun_st_get_active_attrib_path(struct subtype *st, free(hctl); name += strlen(SCSI_ATTR_PREFIX); + } else { + devpath = path_get_zfcp_lun_dev(dev->devid); } while (*name == '/')