target/configs: remove trailing newline from udev_path and alias
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Mon, 28 Nov 2011 12:57:25 +0000 (13:57 +0100)
committerNicholas Bellinger <nab@linux-iscsi.org>
Wed, 14 Dec 2011 11:28:10 +0000 (11:28 +0000)
This patch strips the trailing newline from backend device udev_path and
alias attributes.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_configfs.c

index eb62371611f652f7ba13c11a5218dd5a4d366bb0..0955bb8979fb6f77dc54bf500810db4c83615f91 100644 (file)
@@ -1708,6 +1708,9 @@ static ssize_t target_core_store_dev_alias(
        read_bytes = snprintf(&se_dev->se_dev_alias[0], SE_DEV_ALIAS_LEN,
                        "%s", page);
 
+       if (se_dev->se_dev_alias[read_bytes - 1] == '\n')
+               se_dev->se_dev_alias[read_bytes - 1] = '\0';
+
        pr_debug("Target_Core_ConfigFS: %s/%s set alias: %s\n",
                config_item_name(&hba->hba_group.cg_item),
                config_item_name(&se_dev->se_dev_group.cg_item),
@@ -1754,6 +1757,9 @@ static ssize_t target_core_store_dev_udev_path(
        read_bytes = snprintf(&se_dev->se_dev_udev_path[0], SE_UDEV_PATH_LEN,
                        "%s", page);
 
+       if (se_dev->se_dev_udev_path[read_bytes - 1] == '\n')
+               se_dev->se_dev_udev_path[read_bytes - 1] = '\0';
+
        pr_debug("Target_Core_ConfigFS: %s/%s set udev_path: %s\n",
                config_item_name(&hba->hba_group.cg_item),
                config_item_name(&se_dev->se_dev_group.cg_item),