*str += strlen(*str) + 1;
type = next_arg(ctx, str, true, false);
- if (!uci_validate_str(type, false))
+ if (!uci_validate_type(type))
uci_parse_error(ctx, type, "invalid character in field");
name = next_arg(ctx, str, false, true);
assert_eol(ctx, str);
* NB: the config file can still override the package name
*/
if (name) {
- UCI_ASSERT(ctx, uci_validate_str(name, false));
+ UCI_ASSERT(ctx, uci_validate_package(name));
pctx->name = name;
}
{
char *filename;
- UCI_ASSERT(ctx, uci_validate_str(name, false));
+ UCI_ASSERT(ctx, uci_validate_package(name));
filename = uci_malloc(ctx, strlen(name) + strlen(ctx->confdir) + 2);
sprintf(filename, "%s/%s", ctx->confdir, name);
}
rewind(f);
- ftruncate(fileno(f), 0);
+ if (ftruncate(fileno(f), 0) < 0)
+ UCI_THROW(ctx, UCI_ERR_IO);
uci_export(ctx, f, p, false);
UCI_TRAP_RESTORE(ctx);
if (!p)
continue;
- if (!uci_validate_name(p))
+ if (!uci_validate_package(p))
continue;
configs[i] = buf;
buf += strlen(buf) + 1;
}
free(dir);
+ globfree(&globbuf);
return configs;
}