commit 3f23048f7b69bd4018939ad608797e818828e871 parent 005ee04b9f6484c1831c655fcfb246424919fca1 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(-)
diff --git 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; }