From 5d8a1e423086b4800f3874d5ae35069c5a3d307b Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Wed, 9 Mar 2022 22:08:47 -0500 Subject: [PATCH] Small Debug Fixes --- docs/INSTALL.md | 4 ---- launcher/src/bootstrap.c | 7 +++++-- launcher/src/bootstrap.h | 2 ++ launcher/src/client/launcher.cpp | 2 +- launcher/src/server/launcher.c | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 1d63d43f2..2b2582c3a 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -1,10 +1,6 @@ # Manual Installation [Download Packages Here](https://jenkins.thebrokenrail.com/job/minecraft-pi-reborn/job/master/lastSuccessfulBuild/artifact/out/) -## Supported Distributions -* Ubuntu 20.04+ -* Debian Bullseye+ - ## Picking A Package ### Name Format diff --git a/launcher/src/bootstrap.c b/launcher/src/bootstrap.c index 5da18ff84..c815f6818 100644 --- a/launcher/src/bootstrap.c +++ b/launcher/src/bootstrap.c @@ -31,9 +31,12 @@ static void trim(char **value) { *value = &(*value)[1]; } } -static void set_and_print_env(const char *name, char *value) { +void set_and_print_env(const char *name, char *value) { // Set Variable With No Trailing Colon - trim(&value); + static const char *unmodified_name_prefix = "MCPI_"; + if (strncmp(unmodified_name_prefix, name, strlen(unmodified_name_prefix)) != 0) { + trim(&value); + } #ifdef DEBUG // Print New Value diff --git a/launcher/src/bootstrap.h b/launcher/src/bootstrap.h index 9559fd4f3..dfc8de352 100644 --- a/launcher/src/bootstrap.h +++ b/launcher/src/bootstrap.h @@ -4,6 +4,8 @@ extern "C" { #endif +void set_and_print_env(const char *name, char *value); + void bootstrap(int argc, char *argv[]); #ifdef __cplusplus diff --git a/launcher/src/client/launcher.cpp b/launcher/src/client/launcher.cpp index e4d672392..556b5a7cd 100644 --- a/launcher/src/client/launcher.cpp +++ b/launcher/src/client/launcher.cpp @@ -92,7 +92,7 @@ static void run_command_and_set_env(const char *env_name, char *command[]) { output[length - 1] = '\0'; } // Set - setenv(env_name, output, 1); + set_and_print_env(env_name, output); } // Check Return Code if (return_code != 0) { diff --git a/launcher/src/server/launcher.c b/launcher/src/server/launcher.c index 6933fecf6..f0cc97810 100644 --- a/launcher/src/server/launcher.c +++ b/launcher/src/server/launcher.c @@ -6,7 +6,7 @@ int main(int argc, char *argv[]) { // Set Home To Current Directory, So World Data Is Stored There char *launch_directory = getcwd(NULL, 0); - setenv("HOME", launch_directory, 1); + set_and_print_env("HOME", launch_directory); free(launch_directory); // Bootstrap