tremove temp files on close - 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 3f23048f7b69bd4018939ad608797e818828e871
(DIR) parent 005ee04b9f6484c1831c655fcfb246424919fca1
(HTM) Author: rsc <devnull@localhost>
Date: Thu, 17 Jun 2004 21:19:37 +0000
remove temp files on close
Diffstat:
M src/lib9/opentemp.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/src/lib9/opentemp.c b/src/lib9/opentemp.c
t@@ -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;
}