assert(out_fd >= 0);
assert(item);
- const char *const title = item->fields[INI_FIELD_TITLE];
- const char *const path = item->fields[INI_FIELD_PATH];
- const char *const args = item->fields[INI_FIELD_ARGS] ?: "";
- const char *const env = item->fields[INI_FIELD_ENV] ?: "";
- const char *const flag = item->fields[INI_FIELD_FLAG];
+ char *const title = item->fields[INI_FIELD_TITLE];
+ char *const path = item->fields[INI_FIELD_PATH];
+ char *const args = item->fields[INI_FIELD_ARGS] ?: "";
+ char *const env = item->fields[INI_FIELD_ENV] ?: "";
+ char *const flag = item->fields[INI_FIELD_FLAG];
if (!check_cmdflag(flag, argc, argv))
return 0;
assert(out_fd >= 0);
assert(item);
- const char *const title = item->fields[INI_FIELD_TITLE];
- const char *const path = item->fields[INI_FIELD_PATH];
+ char *const title = item->fields[INI_FIELD_TITLE];
+ char *const path = item->fields[INI_FIELD_PATH];
if (!title || !path) {
fprintf_fd(out_fd, "\nNo title or path in extra file config");
return EXIT_CONFERR;
typedef int (*handle_ini_section_t)(int out_fd, struct extra_dump_item *, int argc, char **argv);
-static int handle_ini_Nth_section(struct extra_dump_item *item, const dictionary *ini, int n)
+static int handle_ini_Nth_section(struct extra_dump_item *item, dictionary *ini, int n)
{
assert(item);
assert(ini);
assert(n >= 0);
assert(n < iniparser_getnsec(ini));
- const char *const secname = iniparser_getsecname(ini, n);
+ char *const secname = iniparser_getsecname(ini, n);
assert(secname); // can only be NULL if `ini` is NULL or `n` is outta bounds
const size_t secname_len = strlen(secname);
key_buf[secname_len] = ':';
int ret = 0;
- char *const key_suffix_ptr = key_buf + secname_len + 1;
+ char *key_suffix_ptr = key_buf + secname_len + 1;
for (size_t i = 0; i < ARRAY_SIZE(item->fields); ++i) {
strcpy(key_suffix_ptr, INI_KEYS[i]);
- const char *tmp = iniparser_getstring(ini, key_buf, NULL);
+ char *tmp = iniparser_getstring(ini, key_buf, NULL);
if (!tmp) {
item->fields[i] = NULL;
continue;
}
strcpy(key_suffix_ptr, "order");
- const char *tmp = iniparser_getstring(ini, key_buf, NULL);
+ char *tmp = iniparser_getstring(ini, key_buf, NULL);
item->order = tmp ? atoi(tmp) : INT_MAX;
return ret;
return REP_TYPE_INVALID;
}
-static int config_load_exclude_paths(config_t *c, const dictionary *ini)
+static int config_load_exclude_paths(config_t *c, dictionary *ini)
{
assert(c);
assert(ini);
if (n <= 0)
return 0;
- const char **keys = alloca(sizeof(char *) * n);
+ char **keys = alloca(sizeof(char *) * n);
int total = n + c->n_exclude_paths;
int n_added = 0;
- c->exclude_paths = reallocarray(c->exclude_paths, sizeof(char *), total);
+ c->exclude_paths = realloc(c->exclude_paths, sizeof(char *) * total);
if (!keys || !c->exclude_paths)
goto err_oom;
- keys = iniparser_getseckeys(ini, EXCLUDEPATHS_SECTION, keys);
+ keys = iniparser_getseckeys(ini, EXCLUDEPATHS_SECTION);
if (!keys)
goto err_oom;
return false;
}
-static bool config_load_from_dict(config_t *c, const dictionary *ini)
+static bool config_load_from_dict(config_t *c, dictionary *ini)
{
assert(c);
assert(ini);
#define LEGACY_NOTIFICATION 0
#define CRASH_SECTION "CrashManager"
-#define EXCLUDEPATHS_SECTION "ExcludePaths"
+
+/* ExcludePaths section name must be lowercase with iniparser 3.x.
+ *
+ * This is to workaround for iniparser 3.x bug, where loaded strings
+ * are converted to lowercase, but query string is not, precisely
+ * getsecnkeys() does strcmp(lowercase-key-in-db, user-provided-str).
+ */
+#define EXCLUDEPATHS_SECTION "excludepaths"
enum ReportType {
REP_TYPE_INVALID = -1,