support/Archivable: Reset errno in validate_instantiation()

validate_instantiation(BMessage*, const char*) sets errno for invalid
input, or if the requested class is not found, but it doesn't reset
errno to B_OK if validation succeeds.

I verified that in BeOS R5, errno is set to B_OK if
validate_instantiation succeeds.

This fixes BHandler::Instantiate2 and BHandler::Instantiate3 tests.

Change-Id: I531777e6ba47e9635da2da1fc8c8103bb233b0f3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2136
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Kyle Ambroff-Kao 2020-01-20 15:37:06 -08:00 committed by Adrien Destugues
parent 58bf3f3628
commit 7037b5d9bc

View File

@ -762,8 +762,10 @@ validate_instantiation(BMessage* from, const char* className)
const char* archiveClassName;
for (int32 index = 0; from->FindString(B_CLASS_FIELD, index,
&archiveClassName) == B_OK; ++index) {
if (name == archiveClassName)
if (name == archiveClassName) {
errno = B_OK;
return true;
}
}
if (!add_private_namespace(name))