From 9e638c99927c296976b39574645b07fc193c4cd8 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 29 Dec 2025 16:00:47 +0100 Subject: [PATCH] xqd_{dictionary,store}_open: return XqdErrNone when the store doesn't exist This matches what we do in xqd_secret_store_open and what happens on Fastly's platform. --- xqd_config_store.go | 7 +++++-- xqd_dictionary.go | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/xqd_config_store.go b/xqd_config_store.go index 055276f..995f7a5 100644 --- a/xqd_config_store.go +++ b/xqd_config_store.go @@ -15,10 +15,13 @@ func (i *Instance) xqd_config_store_open(name_addr int32, name_size int32, addr i.abilog.Printf("config_store_open: name=%s\n", configStoreName) - // Allocate a handle for this config store and write it to guest memory handle := i.getConfigStoreHandle(configStoreName) - i.memory.PutUint32(uint32(handle), int64(addr)) + if handle == HandleInvalid { + i.memory.PutUint32(HandleInvalid, int64(addr)) + return XqdErrNone + } + i.memory.PutUint32(uint32(handle), int64(addr)) return XqdStatusOK } diff --git a/xqd_dictionary.go b/xqd_dictionary.go index 1f18bc7..dc18ab2 100644 --- a/xqd_dictionary.go +++ b/xqd_dictionary.go @@ -15,10 +15,13 @@ func (i *Instance) xqd_dictionary_open(name_addr int32, name_size int32, addr in i.abilog.Printf("dictionary_open: name=%s\n", dictionaryName) - // Allocate a handle for this dictionary and write it to guest memory handle := i.getDictionaryHandle(dictionaryName) - i.memory.PutUint32(uint32(handle), int64(addr)) + if handle == HandleInvalid { + i.memory.PutUint32(HandleInvalid, int64(addr)) + return XqdErrNone + } + i.memory.PutUint32(uint32(handle), int64(addr)) return XqdStatusOK }