lib9: revert unintended changes to opentemp
This commit is contained in:
parent
0a40aeedbf
commit
e960e21be1
1 changed files with 5 additions and 11 deletions
|
|
@ -2,20 +2,14 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
opentemp(char *template, int mode)
|
opentemp(char *template)
|
||||||
{
|
{
|
||||||
int fd, fd1;
|
int fd;
|
||||||
|
|
||||||
fd = mkstemp(template);
|
fd = mkstemp(template);
|
||||||
if(fd < 0)
|
if(fd < 0)
|
||||||
return -1;
|
return -1;
|
||||||
/* reopen for mode */
|
|
||||||
fd1 = open(template, mode);
|
|
||||||
if(fd1 < 0){
|
|
||||||
close(fd);
|
|
||||||
remove(template);
|
remove(template);
|
||||||
return -1;
|
return fd;
|
||||||
}
|
|
||||||
close(fd);
|
|
||||||
return fd1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue