File 0001-Remove-leading-trailing-white-space-in-read_sysfs_at.patch of Package udisks2.7587
From f83b7874ac1be00337485770ceaaaf65e6df7221 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Mon, 16 Oct 2017 12:41:22 +0200
Subject: [PATCH] Remove leading/trailing white space in 'read_sysfs_attr'
So we don't have to call 'g_strstrip' after using it.
Related: rhbz#1400056
(cherry picked from commit 61ff342139f21663958bcc2972a3efa37cf7bc83)
ported to v2.1.3
---
src/udiskslinuxmdraid.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/udiskslinuxmdraid.c b/src/udiskslinuxmdraid.c
index d7c507a4..2bfd6335 100644
--- a/src/udiskslinuxmdraid.c
+++ b/src/udiskslinuxmdraid.c
@@ -142,6 +142,10 @@ read_sysfs_attr (GUdevDevice *device,
goto out;
}
+ /* remove newline from the attribute */
+ if (ret != NULL)
+ g_strstrip (ret);
+
out:
g_free (path);
return ret;
@@ -362,14 +366,8 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid,
/* Can't use GUdevDevice methods as they cache the result and these variables vary */
degraded = read_sysfs_attr_as_int (raid_device->udev_device, "md/degraded");
sync_action = read_sysfs_attr (raid_device->udev_device, "md/sync_action");
- if (sync_action != NULL)
- g_strstrip (sync_action);
sync_completed = read_sysfs_attr (raid_device->udev_device, "md/sync_completed");
- if (sync_completed != NULL)
- g_strstrip (sync_completed);
bitmap_location = read_sysfs_attr (raid_device->udev_device, "md/bitmap/location");
- if (bitmap_location != NULL)
- g_strstrip (bitmap_location);
}
if (has_stripes)
@@ -473,7 +471,6 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid,
member_state = read_sysfs_attr (raid_device->udev_device, buf);
if (member_state != NULL)
{
- g_strstrip (member_state);
member_state_elements = g_strsplit (member_state, ",", 0);
}
@@ -481,7 +478,6 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid,
member_slot = read_sysfs_attr (raid_device->udev_device, buf);
if (member_slot != NULL)
{
- g_strstrip (member_slot);
if (g_strcmp0 (member_slot, "none") != 0)
member_slot_as_int = atoi (member_slot);
}
--
2.16.4