diff options
author | rsc <devnull@localhost> | 2006-08-29 20:15:01 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2006-08-29 20:15:01 +0000 |
commit | 21c4c72798b0bf2fb9a2761744bc41e89fc87fcc (patch) | |
tree | 9e1c6e9c7833eb8e4da6425206ed79a237f9e777 /src | |
parent | c7c29d26b7f9bcd735779859211bf525f007078e (diff) | |
download | plan9port-21c4c72798b0bf2fb9a2761744bc41e89fc87fcc.tar.gz plan9port-21c4c72798b0bf2fb9a2761744bc41e89fc87fcc.tar.bz2 plan9port-21c4c72798b0bf2fb9a2761744bc41e89fc87fcc.zip |
Aviod seg fault when no file
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/sam/shell.c | 5 |
1 files changed, 4 insertions, 1 deletions
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); } |