>From 98f1b3cf4ea61a15f54561e9b5ce5359823769ce Mon Sep 17 00:00:00 2001
From: Mike McCormack <[email protected]>
Date: Thu, 14 Apr 2011 14:15:56 +0900
Subject: [PATCH 2/9] Check whether conf_cputransparency_native is nil before
 indexing it.

Avoids this error:

Scratchbox2: Lua interpreter PANIC: unprotected error in call to Lua API (...mike-20110414-141539.nTGA7q/lua_scripts/argvenvp.lua:897: attempt to index global 'conf_cputransparency_native' (a nil value))
sb2: Error: Failed to find out how /home/mike/sbs-install/bin/qemu-arm should be started
sbs: failed to perform requested operation

Change-Id: I8eb3507e11273ee24389ca11ba17cb2d669c3ffd
---
 lua_scripts/argvenvp.lua |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lua_scripts/argvenvp.lua b/lua_scripts/argvenvp.lua
index c95c2b2..9dd7a05 100644
--- a/lua_scripts/argvenvp.lua
+++ b/lua_scripts/argvenvp.lua
@@ -552,10 +552,10 @@ function sb_execve_postprocess_native_executable(rule, exec_policy,
 end
 
 for k, v in pairs({conf_cputransparency_target, conf_cputransparency_native}) do
-	if string.match(v.cmd, "qemu") then
+	if (v ~= nil and string.match(v.cmd, "qemu")) then
 		v.method_is_qemu = true
 	end
-	if string.match(v.cmd, "sbrsh") then
+	if (v ~= nil and string.match(v.cmd, "sbrsh")) then
 		v.method_is_sbrsh = true
 	end
 end
@@ -894,7 +894,7 @@ function sb_execve_postprocess(rule, exec_policy, exec_type,
 			exec_policy, exec_type, mapped_file,
 			filename, argv, envp, conf_cputransparency_target)
 	elseif (exec_type == "static") then
-		if (conf_cputransparency_native.cmd ~= "") then
+		if (conf_cputransparency_native ~= nil and conf_cputransparency_native.cmd ~= "") then
 			return sb_execve_postprocess_cpu_transparency_executable(rule,
 				exec_policy, exec_type, mapped_file,
 				filename, argv, envp, conf_cputransparency_native)
-- 
1.7.9.1


_______________________________________________
Scratchbox-devel mailing list
[email protected]
http://lists.scratchbox.org/cgi-bin/mailman/listinfo/scratchbox-devel

Reply via email to