Blob Blame History Raw
autofs-5.0.6 - use strtok_r() in linux_version_code()

From: Ian Kent <ikent@redhat.com>

Use re-entrant version of strtok() in linux_version_code() function.
Also fix tab formatting.
---

 CHANGELOG        |    1 +
 include/mounts.h |   17 +++++++++--------
 2 files changed, 10 insertions(+), 8 deletions(-)


--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -36,6 +36,7 @@
 - fix rework error return handling in rpc code.
 - allow MOUNT_WAIT to override probe.
 - improve UDP RPC timeout handling.
+- use strtok_r() in linux_version_code().
 
 28/06/2011 autofs-5.0.6
 -----------------------
--- autofs-5.0.6.orig/include/mounts.h
+++ autofs-5.0.6/include/mounts.h
@@ -77,16 +77,17 @@ struct mnt_list {
 
 static inline unsigned int linux_version_code(void)
 {
-        struct utsname my_utsname;
-        unsigned int p, q, r;
+	struct utsname my_utsname;
+	unsigned int p, q, r;
+	char *save;
 
-        if (uname(&my_utsname))
-                return 0;
+	if (uname(&my_utsname))
+		return 0;
 
-        p = (unsigned int)atoi(strtok(my_utsname.release, "."));
-        q = (unsigned int)atoi(strtok(NULL, "."));
-        r = (unsigned int)atoi(strtok(NULL, "."));
-        return KERNEL_VERSION(p, q, r);
+	p = (unsigned int) atoi(strtok_r(my_utsname.release, ".", &save));
+	q = (unsigned int) atoi(strtok_r(NULL, ".", &save));
+	r = (unsigned int) atoi(strtok_r(NULL, ".", &save));
+	return KERNEL_VERSION(p, q, r);
 }
 
 struct nfs_mount_vers {