diff --git a/src/lib/parse_conf.c b/src/lib/parse_conf.c index 4b054189051..143509fcfd8 100644 --- a/src/lib/parse_conf.c +++ b/src/lib/parse_conf.c @@ -196,6 +196,19 @@ static inline void init_resource(CONFIG *config, int type, RES_ITEM *items, int Dmsg3(900, "Item=%s def=%s defval=%s\n", items[i].name, (items[i].flags & ITEM_DEFAULT) ? "yes" : "no", (items[i].default_value) ? items[i].default_value : "None"); + + /* + * Sanity check. + * + * Items with a default value but without the ITEM_DEFAULT flag set + * are most of the time an indication of a programmers error. + */ + if (items[i].default_value != NULL && !(items[i].flags & ITEM_DEFAULT)) { + Pmsg1(000, _("Found config item %s which has default value but no ITEM_DEFAULT flag set\n"), + items[i].name); + items[i].flags |= ITEM_DEFAULT; + } + if (items[i].flags & ITEM_DEFAULT && items[i].default_value != NULL) { /* * First try to handle the generic types. diff --git a/src/stored/stored_conf.c b/src/stored/stored_conf.c index 59faa6fda12..2db789cbdfa 100644 --- a/src/stored/stored_conf.c +++ b/src/stored/stored_conf.c @@ -157,7 +157,7 @@ static RES_ITEM dev_items[] = { { "forwardspacefile", store_bit, ITEM(res_dev.cap_bits), CAP_FSF, ITEM_DEFAULT, "on" }, { "fastforwardspacefile", store_bit, ITEM(res_dev.cap_bits), CAP_FASTFSF, ITEM_DEFAULT, "on" }, { "removablemedia", store_bit, ITEM(res_dev.cap_bits), CAP_REM, ITEM_DEFAULT, "on" }, - { "randomaccess", store_bit, ITEM(res_dev.cap_bits), CAP_RACCESS, 0, "off" }, + { "randomaccess", store_bit, ITEM(res_dev.cap_bits), CAP_RACCESS, ITEM_DEFAULT, "off" }, { "automaticmount", store_bit, ITEM(res_dev.cap_bits), CAP_AUTOMOUNT, ITEM_DEFAULT, "off" }, { "labelmedia", store_bit, ITEM(res_dev.cap_bits), CAP_LABEL, ITEM_DEFAULT, "off" }, { "alwaysopen", store_bit, ITEM(res_dev.cap_bits), CAP_ALWAYSOPEN, ITEM_DEFAULT, "on" },