diff options
author | rsc <devnull@localhost> | 2004-06-17 21:19:37 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-06-17 21:19:37 +0000 |
commit | 3f23048f7b69bd4018939ad608797e818828e871 (patch) | |
tree | a8eb5334a7d11e44fa367f0e34993d2ce01918be | |
parent | 005ee04b9f6484c1831c655fcfb246424919fca1 (diff) | |
download | plan9port-3f23048f7b69bd4018939ad608797e818828e871.tar.gz plan9port-3f23048f7b69bd4018939ad608797e818828e871.tar.bz2 plan9port-3f23048f7b69bd4018939ad608797e818828e871.zip |
remove temp files on close
-rw-r--r-- | src/lib9/opentemp.c | 8 |
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; } |