autofs-5.0.6 - use strtok_r() in linux_version_code() From: Ian Kent 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(-) diff --git a/CHANGELOG b/CHANGELOG index f09ebf4..ed4aa70 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -40,6 +40,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 ----------------------- diff --git a/include/mounts.h b/include/mounts.h index 9aac90f..18edd45 100644 --- a/include/mounts.h +++ b/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 {