From 21c4c72798b0bf2fb9a2761744bc41e89fc87fcc Mon Sep 17 00:00:00 2001 From: rsc Date: Tue, 29 Aug 2006 20:15:01 +0000 Subject: Aviod seg fault when no file --- src/cmd/sam/shell.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/cmd/sam') diff --git a/src/cmd/sam/shell.c b/src/cmd/sam/shell.c index ba69be6e..e8650958 100644 --- a/src/cmd/sam/shell.c +++ b/src/cmd/sam/shell.c @@ -12,7 +12,10 @@ void setname(File *f) { char buf[1024]; - snprint(buf, sizeof buf, "%.*S", f->name.n, f->name.s); + if(f) + snprint(buf, sizeof buf, "%.*S", f->name.n, f->name.s); + else + buf[0] = 0; putenv("samfile", buf); } -- cgit v1.2.3