OSDN Git Service

Fixed options string parsing.
authorresver <resver@60bc1c72-a15a-11de-b98f-4500b42dc123>
Tue, 22 Dec 2009 21:53:00 +0000 (21:53 +0000)
committerresver <resver@60bc1c72-a15a-11de-b98f-4500b42dc123>
Tue, 22 Dec 2009 21:53:00 +0000 (21:53 +0000)
git-svn-id: http://exfat.googlecode.com/svn/trunk@91 60bc1c72-a15a-11de-b98f-4500b42dc123

libexfat/mount.c

index 56b78ab..5d449d3 100644 (file)
@@ -35,14 +35,13 @@ static uint64_t rootdir_size(const struct exfat* ef)
 
 static const char* get_option(const char* options, const char* option_name)
 {
-       const char* p = strstr(options, option_name);
+       const char* p;
        size_t length = strlen(option_name);
 
-       if (p == NULL)
-               return NULL;
-       if ((p != options && p[-1] != ',') || p[length] != '=')
-               return NULL;
-       return p + length + 1;
+       for (p = strstr(options, option_name); p; p = strstr(p + 1, option_name))
+               if ((p == options || p[-1] == ',') && p[length] == '=')
+                       return p + length + 1;
+       return NULL;
 }
 
 static int get_int_option(const char* options, const char* option_name,