ref: ab3492f05e5998f79befe6e7397175f4bdb39149
parent: d8b4f95476216bd9e50d98c8e3ada629a6ac32f1
author: ftrvxmtrx <ftrvxmtrx@gmail.com>
date: Mon Sep 26 19:00:06 EDT 2016
sam: putenv("%", ...): don't crash when no file is current
--- a/sys/src/cmd/sam/shell.c
+++ b/sys/src/cmd/sam/shell.c
@@ -93,7 +93,7 @@
close(0); /* so it won't read from terminal */
open("/dev/null", 0);
}
- putenv("%", Strtoc(&f->name));
+ putenv("%", f == nil ? "" : Strtoc(&f->name));
execl(SHPATH, SH, "-c", Strtoc(&plan9cmd), nil);
exits("exec");
}