hooks: implement hack to avoid plugins setting errors
@@ -1000,6 +1000,15 @@ KDB * kdbOpen (const KeySet * contract, Key * errorKey)
}
// TODO (atmaxinger): improve
+ bool existingError = keyGetMeta (errorKey, "error") != NULL;
+
+ if (!existingError)
+ {
+ // set a dummy value to block errors
+ // any errors that occur will be converted into warnings
+ keySetMeta (errorKey, "error", "blocked");
+ }
+
if (initHooks (handle, handle->modules, contract, errorKey) == -1)
{
ELEKTRA_SET_INSTALLATION_ERROR (errorKey, "Initializing hooks failed. Please see warning of concrete plugin");
@@ -1007,6 +1016,12 @@ KDB * kdbOpen (const KeySet * contract, Key * errorKey)
goto error;
}
+ if (!existingError)
+ {
+ // remove dummy error again
+ keySetMeta (errorKey, "error", NULL);
+ }
+
// Step 5: process contract
if (contract != NULL && !ensureContract (handle, contract, errorKey))
{
