tsam: report close error - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit a1ead676e69d46df89dd0de12cf86380c5773353
 (DIR) parent 0b349f6f34f1fff58ab9748277a093f70df2be33
 (HTM) Author: Russ Cox <rsc@swtch.com>
       Date:   Thu, 19 Dec 2019 15:00:58 -0500
       
       sam: report close error
       
       Diffstat:
         M src/cmd/sam/io.c                    |       2 +-
         M src/cmd/sam/sam.h                   |       1 +
         M src/cmd/sam/sys.c                   |       7 +++++++
       
       3 files changed, 9 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/src/cmd/sam/io.c b/src/cmd/sam/io.c
       t@@ -166,7 +166,7 @@ writeio(File *f)
        void
        closeio(Posn p)
        {
       -        close(io);
       +        Close(io);
                io = 0;
                if(p >= 0)
                        dprint("#%lud\n", p);
 (DIR) diff --git a/src/cmd/sam/sam.h b/src/cmd/sam/sam.h
       t@@ -237,6 +237,7 @@ int        Read(int, void*, int);
        void        Seek(int, long, int);
        int        plan9(File*, int, String*, int);
        int        Write(int, void*, int);
       +void        Close(int);
        int        bexecute(File*, Posn);
        void        cd(String*);
        void        closefiles(File*, String*);
 (DIR) diff --git a/src/cmd/sam/sys.c b/src/cmd/sam/sys.c
       t@@ -58,3 +58,10 @@ Seek(int f, long n, int w)
                if(seek(f, n, w)==-1)
                        syserror("seek");
        }
       +
       +void
       +Close(int f)
       +{
       +        if(close(f) < 0)
       +                syserror("close");
       +}