File path_environment.patch of Package firmwarekit

---
 main.c |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

--- a/main.c
+++ b/main.c
@@ -33,6 +33,7 @@
 
 #include "biostest.h"
 
+static char* path_env;
 
 int use_serial;
 static unsigned long serial_speed;
@@ -173,6 +174,26 @@ static void parse_kernel_cmdline(void)
 	}
 }
 
+static void set_path_env(void)
+{
+	int ret;
+	char new_path_env[8192];
+	path_env = getenv("PATH");
+	ret = snprintf(new_path_env, 8192, "PATH=%s:"
+		       "/usr/lib/firmwarekit/bin", path_env);
+	if (ret >= 8192){
+		fprintf(stderr, "FATAL: PATH environment variable too big,"
+			" increase string array -> that's a bug\n");
+		exit (EXIT_FAILURE);
+	}
+	ret = putenv(new_path_env);
+	if (ret){
+		fprintf(stderr, "FATAL: Could not set PATH environment"
+			"variable to %s\n", new_path_env);
+		exit (EXIT_FAILURE);
+	}
+}
+
 int main(int argc, char **argv)
 {
 	int ret;
@@ -210,6 +231,8 @@ int main(int argc, char **argv)
 	/* register e820 resource */
 	e820_register_resource();
 
+	set_path_env();
+
 	/* display welcome msg, init newt root window 
 	 * (implemented in ui.c) */
 	init_results_ui();	
openSUSE Build Service is sponsored by