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 }