aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2019-12-19 15:00:58 -0500
committerRuss Cox <rsc@swtch.com>2019-12-19 15:00:58 -0500
commita1ead676e69d46df89dd0de12cf86380c5773353 (patch)
tree05f8ae0b83e6ba884176db8d3d2d43b87dcf2801
parent0b349f6f34f1fff58ab9748277a093f70df2be33 (diff)
downloadplan9port-a1ead676e69d46df89dd0de12cf86380c5773353.tar.gz
plan9port-a1ead676e69d46df89dd0de12cf86380c5773353.tar.bz2
plan9port-a1ead676e69d46df89dd0de12cf86380c5773353.zip
sam: report close error
-rw-r--r--src/cmd/sam/io.c2
-rw-r--r--src/cmd/sam/sam.h1
-rw-r--r--src/cmd/sam/sys.c7
3 files changed, 9 insertions, 1 deletions
diff --git a/src/cmd/sam/io.c b/src/cmd/sam/io.c
index 8740c7ca..c112c0a1 100644
--- a/src/cmd/sam/io.c
+++ b/src/cmd/sam/io.c
@@ -166,7 +166,7 @@ writeio(File *f)
void
closeio(Posn p)
{
- close(io);
+ Close(io);
io = 0;
if(p >= 0)
dprint("#%lud\n", p);
diff --git a/src/cmd/sam/sam.h b/src/cmd/sam/sam.h
index c2aaa070..c11163ef 100644
--- a/src/cmd/sam/sam.h
+++ b/src/cmd/sam/sam.h
@@ -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*);
diff --git a/src/cmd/sam/sys.c b/src/cmd/sam/sys.c
index db54d28d..7eed4c9e 100644
--- a/src/cmd/sam/sys.c
+++ b/src/cmd/sam/sys.c
@@ -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");
+}