X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fmake_ext4fs.git;a=blobdiff_plain;f=canned_fs_config.c;h=a034005a57545079e8dfbab11ace7606550bb9ae;hp=6bd1b226cbe47199ae985ca6c435da09a465931a;hb=bd53eaafbc2a89a57b8adda38f53098a431fa8f4;hpb=8597212da10cdf192cf719059d63d59d5df41ed8 diff --git a/canned_fs_config.c b/canned_fs_config.c index 6bd1b22..a034005 100644 --- a/canned_fs_config.c +++ b/canned_fs_config.c @@ -52,15 +52,19 @@ int load_canned_fs_config(const char* fn) { 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")); + + if (!p->path || !*p->path || *p->path == '#') + continue; + + 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 { - token = strtok(NULL, " "); + token = strtok(NULL, " \t"); if (token && strncmp(token, "capabilities=", 13) == 0) { p->capabilities = strtoll(token+13, NULL, 0); break;