[libvirt] [PATCH] openvz_conf.c: remove dead store to "p"; use strchrnul

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

 



I may separate this into two commits.
Currently we can't use the part that adds the strchrnul use,
since gnulib's module lists its license as LGPL, which
means LGPLv3+, and that conflicts with libvirt's LGPLv2+ requirement.
However, since strchrnul is derived from glibc, it should be easy
to adjust that.  I've asked the maintainer of that module on the
bug-gnulib list.  We'll see later today when the US wakes up.

>From b76bc73df65c793958ce646fd80763c19a9e4dbd Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Tue, 8 Sep 2009 11:07:32 +0200
Subject: [PATCH] openvz_conf.c: remove dead store to "p"; use strchrnul

* src/openvz_conf.c (openvzReadNetworkConf): Replace open-coded
while loop with equivalent use of strchrnul.
* bootstrap (modules): Add strchrnul.
---
 bootstrap         |    1 +
 src/openvz_conf.c |    5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bootstrap b/bootstrap
index 8b81e0e..5560792 100755
--- a/bootstrap
+++ b/bootstrap
@@ -89,6 +89,7 @@ send
 setsockopt
 socket
 stpcpy
+strchrnul
 strndup
 strerror
 strsep
diff --git a/src/openvz_conf.c b/src/openvz_conf.c
index ce4fc6e..be94b9e 100644
--- a/src/openvz_conf.c
+++ b/src/openvz_conf.c
@@ -239,15 +239,14 @@ openvzReadNetworkConf(virConnectPtr conn,

             net->type = VIR_DOMAIN_NET_TYPE_BRIDGE;

-            char *p = token, *next = token;
+            char *p = token;
             char cpy_temp[32];
             int len;

             /*parse string*/
             do {
-                while (*next != '\0' && *next != ',') next++;
+                char *next = strchrnul (token, ',');
                 if (STRPREFIX(p, "ifname=")) {
-                    p += 7;
                     /* skip in libvirt */
                 } else if (STRPREFIX(p, "host_ifname=")) {
                     p += 12;
--
1.6.5.rc0.164.g5f6b0

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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]