Support tabs as seaprators when parsing fs config
authorJo-Philipp Wich <jow@openwrt.org>
Sat, 4 Apr 2015 21:39:29 +0000 (23:39 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 8 Apr 2015 05:51:39 +0000 (07:51 +0200)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
canned_fs_config.c

index 6bd1b22..6898ea2 100644 (file)
@@ -52,15 +52,15 @@ int load_canned_fs_config(const char* fn) {
                        canned_data = (Path*) realloc(canned_data, canned_alloc * sizeof(Path));
                }
                Path* p = canned_data + canned_used;
                        canned_data = (Path*) realloc(canned_data, canned_alloc * sizeof(Path));
                }
                Path* p = canned_data + canned_used;
-               p->path = strdup(strtok(line, " "));
-               p->uid = atoi(strtok(NULL, " "));
-               p->gid = atoi(strtok(NULL, " "));
-               p->mode = strtol(strtok(NULL, " "), NULL, 8);   // mode is in octal
+               p->path = strdup(strtok(line, " \t"));
+               p->uid = atoi(strtok(NULL, " \t"));
+               p->gid = atoi(strtok(NULL, " \t"));
+               p->mode = strtol(strtok(NULL, " \t"), NULL, 8);   // mode is in octal
                p->capabilities = 0;
 
                char* token = NULL;
                do {
                p->capabilities = 0;
 
                char* token = NULL;
                do {
-                       token = strtok(NULL, " ");
+                       token = strtok(NULL, " \t");
                        if (token && strncmp(token, "capabilities=", 13) == 0) {
                                p->capabilities = strtoll(token+13, NULL, 0);
                                break;
                        if (token && strncmp(token, "capabilities=", 13) == 0) {
                                p->capabilities = strtoll(token+13, NULL, 0);
                                break;