Skip to contentSkip to conversation

cleanup to use strsep for fs/fat/inode.c

PATCH New Alex Scheele 1 participant 1 message Feb 10, 2002 VFAT/FAT/msdos filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cleanup to use strsep for fs/fat/inode.c

Hi,

This patch changes all use of strtok() to strsep(). Strtok() isn't SMP/thread safe. strsep is considered safer.

--
Alex ([email protected])

-------------------------- cut here -------------------------

fs/fat/inode.c Sun Feb 10 03:47:48 2002 renamed from fs/fat/inode.c Sat Feb 9 21:57:39 2002 +3 -2
diff -uN linux-2.5.3-dj4/fs/fat/inode.c linux/fs/fat/inode.c
@@ -223,8 +223,9 @@
                goto out;
        save = 0;
        savep = NULL;
-       for (this_char = strtok(options,","); this_char;
-            this_char = strtok(NULL,",")) {
+       while ((this_char = strsep(&options,",")) != NULL) {
+               if (!*this_char)
+                       continue;
                if ((value = strchr(this_char,'=')) != NULL) {
                        save = *value;
                        savep = value;