From defc67d02019cc5e6b3a0cc3347fc1eea6046264 Mon Sep 17 00:00:00 2001
From: Kalle Olavi Niemitalo <Kalle@Astalo.kon.iki.fi>
Date: Thu, 5 Apr 2007 10:10:32 +0300
Subject: [PATCH] Bug 880: Prevent SIGSEGV in init_python when -no-home is
 used.

Before this patch, init_python would crash trying to set up the
PYTHONPATH environment variable.  Now it omits the home directory
from the variable in that case.

[ Related to commit 78bd416dc096c56d8f14a1e49c7bf688edfe3872 in ELinks
  0.12.GIT but quite different internally.  --KON ]
---
 src/scripting/python/core.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/scripting/python/core.c b/src/scripting/python/core.c
index fda821884..54643049b 100644
--- a/src/scripting/python/core.c
+++ b/src/scripting/python/core.c
@@ -39,8 +39,12 @@ cleanup_python(struct module *module)
 void
 init_python(struct module *module)
 {
-	unsigned char *python_path = straconcat(elinks_home, ":", CONFDIR, NULL);
+	unsigned char *python_path;
 
+	if (elinks_home)
+		python_path = straconcat(elinks_home, ":", CONFDIR, NULL);
+	else
+		python_path = stracpy(CONFDIR);
 	if (!python_path) return;
 	env_set("PYTHONPATH", python_path, -1);
 	mem_free(python_path);