changeset 172:a88b04ba5ab8

Fixed segfault opening relative paths without a current directory on the stack; probably a symptom of another bug somewhere
author William Astle <lost@l-w.ca>
date Mon, 05 Sep 2011 18:10:21 -0600
parents d59f17580e8b
children 3413a88f4d09
files lwasm/input.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/input.c	Fri Sep 02 18:10:26 2011 -0600
+++ b/lwasm/input.c	Mon Sep 05 18:10:21 2011 -0600
@@ -274,7 +274,7 @@
 
 	/* relative path, check relative to "current file" directory */
 	p = lw_stack_top(as -> file_dir);
-	p2 = make_filename(p, s);
+	p2 = make_filename(p ? p : "", s);
 	debug_message(as, 2, "Open file (st cd) %s", p2);
 	fp = fopen(p2, "rb");
 	if (fp)