// Copyright 2018 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include #include #include #include // zx_object_get_child(ZX_HANDLE_INVALID) should return // ZX_ERR_BAD_HANDLE. ZX-1702 bool handle_invalid() { zx_handle_t process; zx_status_t status; zx_info_handle_basic_t info; zx_handle_t myself = zx_process_self(); status = zx_object_get_info(myself, ZX_INFO_HANDLE_BASIC, &info, sizeof(info), NULL, NULL); ASSERT_EQ(status, ZX_OK); status = zx_object_get_child(ZX_HANDLE_INVALID, info.koid, ZX_RIGHT_SAME_RIGHTS, &process); ASSERT_EQ(status, ZX_ERR_BAD_HANDLE); return true; } BEGIN_TEST_CASE(object_get_child_tests) RUN_TEST(handle_invalid); END_TEST_CASE(object_get_child_tests) #ifndef BUILD_COMBINED_TESTS int main(int argc, char** argv) { return unittest_run_all_tests(argc, argv) ? 0 : -1; } #endif