Support tabs as seaprators when parsing fs config

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
Jo-Philipp Wich 2015-04-04 23:39:29 +02:00
parent 8597212da1
commit 5bb3a9e3de

View File

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