sam: putenv("%", ...): don't crash when no file is current

This commit is contained in:
ftrvxmtrx 2016-09-26 23:00:06 +02:00
parent d8b4f95476
commit ab3492f05e

View file

@ -93,7 +93,7 @@ plan9(File *f, int type, String *s, int nest)
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");
}