Clean Up Some Code, No Noticeable Difference

This commit is contained in:
TheBrokenRail 2021-08-21 23:00:12 -04:00
parent 99b709fea7
commit d372169c79
4 changed files with 4 additions and 4 deletions

View File

@ -130,7 +130,6 @@ void bootstrap(int argc, char *argv[]) {
// Get Binary Directory // Get Binary Directory
char *binary_directory = get_binary_directory(); char *binary_directory = get_binary_directory();
setenv("MCPI_ROOT_PATH", binary_directory, 1);
// Configure LD_LIBRARY_PATH // Configure LD_LIBRARY_PATH
{ {

View File

@ -4,7 +4,7 @@ add_library(reborn-headers INTERFACE)
target_include_directories(reborn-headers INTERFACE include) target_include_directories(reborn-headers INTERFACE include)
if(BUILD_ARM_COMPONENTS) if(BUILD_ARM_COMPONENTS)
add_library(reborn SHARED src/libreborn.c) add_library(reborn SHARED src/reborn.c)
target_link_libraries(reborn dl reborn-headers) target_link_libraries(reborn dl reborn-headers)
# Install # Install
install(TARGETS reborn DESTINATION "${MCPI_LIB_DIR}") install(TARGETS reborn DESTINATION "${MCPI_LIB_DIR}")

View File

@ -20,7 +20,6 @@ __attribute__((noreturn)) static inline void safe_execvpe(const char *pathname,
} }
} }
// Get Binary Directory (Remember To Free) // Get Binary Directory (Remember To Free)
#define EXE_PATH "/proc/self/exe"
static inline char *get_binary_directory() { static inline char *get_binary_directory() {
#ifndef FORCE_PROC_FOR_ROOT_PATH #ifndef FORCE_PROC_FOR_ROOT_PATH
{ {
@ -31,7 +30,6 @@ static inline char *get_binary_directory() {
} }
} }
#endif #endif
// Get Path To Current Executable // Get Path To Current Executable
char *exe = realpath("/proc/self/exe", NULL); char *exe = realpath("/proc/self/exe", NULL);
ALLOC_CHECK(exe); ALLOC_CHECK(exe);
@ -45,6 +43,9 @@ static inline char *get_binary_directory() {
} }
} }
// Set Environment
setenv("MCPI_ROOT_PATH", exe, 1);
// Return // Return
return exe; return exe;
} }