[PATCH 04/10] virlease: Use virTrimSpaces() instead of open coded alternative

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In virLeaseNew() we are trying to remove trailing space (per
comment it may happen that older versions of dnsmasq put it into
an env variable). Well, instead of open coding it, we can use
virTrimSpaces().

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/util/virlease.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/util/virlease.c b/src/util/virlease.c
index f01cf5b9bd..edfdc6477a 100644
--- a/src/util/virlease.c
+++ b/src/util/virlease.c
@@ -226,8 +226,7 @@ virLeaseNew(virJSONValuePtr *lease_ret,
 
         /* Removed extraneous trailing space in DNSMASQ_LEASE_EXPIRES
          * (dnsmasq < 2.52) */
-        if (exptime[strlen(exptime) - 1] == ' ')
-            exptime[strlen(exptime) - 1] = '\0';
+        virTrimSpaces(exptime, NULL);
     }
 
     if (!exptime ||
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux