Path: blob/main/libexec/rtld-elf/tests/set_var_test.c
178428 views
/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2026 Alex S <[email protected]>4*/56#include <atf-c.h>7#include <dlfcn.h>8#include <fcntl.h>9#include <link.h>10#include <stdio.h>1112ATF_TC_WITHOUT_HEAD(set_var_library_path_fds);13ATF_TC_BODY(set_var_library_path_fds, tc)14{15void *handle;16char *pathfds;17int testdir;1819handle = dlopen("libpythagoras.so.0", RTLD_LAZY);20ATF_REQUIRE(handle == NULL);2122testdir = open(atf_tc_get_config_var(tc, "srcdir"),23O_RDONLY | O_DIRECTORY);24ATF_REQUIRE(testdir >= 0);2526ATF_REQUIRE(asprintf(&pathfds, "%d", testdir) > 0);27ATF_REQUIRE(rtld_set_var("LIBRARY_PATH_FDS", pathfds) == 0);2829handle = dlopen("libpythagoras.so.0", RTLD_LAZY);30ATF_REQUIRE(handle != NULL);31}3233ATF_TP_ADD_TCS(tp)34{35ATF_TP_ADD_TC(tp, set_var_library_path_fds);36return atf_no_error();37}383940