URI: 
       tAviod seg fault when no file - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 21c4c72798b0bf2fb9a2761744bc41e89fc87fcc
   DIR parent c7c29d26b7f9bcd735779859211bf525f007078e
  HTML Author: rsc <devnull@localhost>
       Date:   Tue, 29 Aug 2006 20:15:01 +0000
       
       Aviod seg fault when no file
       
       Diffstat:
         M src/cmd/sam/shell.c                 |       5 ++++-
       
       1 file changed, 4 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/src/cmd/sam/shell.c b/src/cmd/sam/shell.c
       t@@ -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);
        }