aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-06-17 21:19:37 +0000
committerrsc <devnull@localhost>2004-06-17 21:19:37 +0000
commit3f23048f7b69bd4018939ad608797e818828e871 (patch)
treea8eb5334a7d11e44fa367f0e34993d2ce01918be
parent005ee04b9f6484c1831c655fcfb246424919fca1 (diff)
downloadplan9port-3f23048f7b69bd4018939ad608797e818828e871.tar.gz
plan9port-3f23048f7b69bd4018939ad608797e818828e871.tar.bz2
plan9port-3f23048f7b69bd4018939ad608797e818828e871.zip
remove temp files on close
-rw-r--r--src/lib9/opentemp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib9/opentemp.c b/src/lib9/opentemp.c
index ff2b3f81..f90bf771 100644
--- a/src/lib9/opentemp.c
+++ b/src/lib9/opentemp.c
@@ -4,6 +4,12 @@
int
opentemp(char *template)
{
- return mkstemp(template);
+ int fd;
+
+ fd = mkstemp(template);
+ if(fd < 0)
+ return -1;
+ remove(template);
+ return fd;
}