[pve-devel] [PATCH cluster 1/3] pmxcfs: cleanup

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Nov 9 09:15:54 CET 2016


---
only the first dot matters and there's already a strchr()...

 data/src/pmxcfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/data/src/pmxcfs.c b/data/src/pmxcfs.c
index e1b6fed..1b6cbcc 100644
--- a/data/src/pmxcfs.c
+++ b/data/src/pmxcfs.c
@@ -800,9 +800,9 @@ int main(int argc, char *argv[])
 		exit (-1);
 	}
 
-	for (int i=0; i < sizeof(utsname.nodename); i++) {
-		if (utsname.nodename[i] =='.') utsname.nodename[i] = 0;
-	}
+	char *dot = strchr(utsname.nodename, '.');
+	if (dot)
+		*dot = 0;
 
 	cfs.nodename = g_strdup(utsname.nodename);
 
-- 
2.1.4





More information about the pve-devel mailing list