[Pkg-wmaker-commits] [wmifs] 94/118: wmifs: Convert strtok() calls to thread-safe strtok_r().

Doug Torrance dtorrance-guest at moszumanska.debian.org
Thu Aug 27 02:37:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository wmifs.

commit 3aca558d6efc3b647a27f1c85a8cfced042f3c0c
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Wed May 27 17:33:28 2015 -0500

    wmifs: Convert strtok() calls to thread-safe strtok_r().
---
 wmifs.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/wmifs.c b/wmifs.c
index 93ea6a3..36e1081 100644
--- a/wmifs.c
+++ b/wmifs.c
@@ -714,7 +714,7 @@ int get_statistics(char *devname, long *ip, long *op, long *is, long *os)
 
 	FILE				*fp;
 	char				temp[BUFFER_SIZE];
-	char				*p;
+	char				*p, *saveptr;
 	char				*tokens = " |:\n";
 	int					input, output;
 	int					i;
@@ -762,7 +762,7 @@ int get_statistics(char *devname, long *ip, long *op, long *is, long *os)
 	i = 0;
 	found = -1;
 
-	p = strtok(temp, tokens);
+	p = strtok_r(temp, tokens, &saveptr);
 	do {
 		if (!(strcmp(p, "packets"))) {
 			if (input == -1)
@@ -771,13 +771,13 @@ int get_statistics(char *devname, long *ip, long *op, long *is, long *os)
 				output = i;
 		}
 		i++;
-		p = strtok(NULL, tokens);
+		p = strtok_r(NULL, tokens, &saveptr);
 	} while (input == -1 || output == -1);
 
 	while (fgets(temp, BUFFER_SIZE, fp)) {
 		if (strstr(temp, devname)) {
 			found = 0;
-			p = strtok(temp, tokens);
+			p = strtok_r(temp, tokens, &saveptr);
 			i = 0;
 			do {
 				if (i == input) {
@@ -789,7 +789,7 @@ int get_statistics(char *devname, long *ip, long *op, long *is, long *os)
 					output = -1;
 				}
 				i++;
-				p = strtok(NULL, tokens);
+				p = strtok_r(NULL, tokens, &saveptr);
 			} while (input != -1 || output != -1);
 		}
 	}
@@ -856,10 +856,10 @@ int checknetdevs(void)
 			return -1;
 		}
 		while (fgets(temp, BUFFER_SIZE, fd)) {
-			char *p;
+			char *p, *saveptr;
 			char *tokens = " :\t\n";
 
-			p = strtok(temp, tokens);
+			p = strtok_r(temp, tokens, &saveptr);
 			if (p == NULL) {
 					printf("Barfed on: %s", temp);
 					break;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmifs.git



More information about the Pkg-wmaker-commits mailing list