comparison lwasm/input.c @ 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 38c1537857ce
children 1824cabf25ce
comparison
equal deleted inserted replaced
171:d59f17580e8b 172:a88b04ba5ab8
272 return fp; 272 return fp;
273 } 273 }
274 274
275 /* relative path, check relative to "current file" directory */ 275 /* relative path, check relative to "current file" directory */
276 p = lw_stack_top(as -> file_dir); 276 p = lw_stack_top(as -> file_dir);
277 p2 = make_filename(p, s); 277 p2 = make_filename(p ? p : "", s);
278 debug_message(as, 2, "Open file (st cd) %s", p2); 278 debug_message(as, 2, "Open file (st cd) %s", p2);
279 fp = fopen(p2, "rb"); 279 fp = fopen(p2, "rb");
280 if (fp) 280 if (fp)
281 { 281 {
282 lw_free(p2); 282 lw_free(p2);