From: Michal Privoznik Date: Fri, 18 Dec 2020 15:09:10 +0000 (+0100) Subject: virlease: Use virTrimSpaces() instead of open coded alternative X-Git-Tag: v7.0.0-rc1~128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=003fff38e753d2d7cacaa3afd3f942f938408334;p=thirdparty%2Flibvirt.git virlease: Use virTrimSpaces() instead of open coded alternative 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 Reviewed-by: Daniel P. Berrangé --- 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 ||