mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:27:43 +00:00
LibC: Implemented mkstemp in stdlib
Implemented mkstemp method in stdlib.
This commit is contained in:
parent
48b1c82d53
commit
bda36853c9
2 changed files with 12 additions and 0 deletions
|
@ -382,6 +382,17 @@ char* mktemp(char* pattern)
|
||||||
return pattern;
|
return pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int mkstemp(char* pattern)
|
||||||
|
{
|
||||||
|
char* path = mktemp(pattern);
|
||||||
|
|
||||||
|
int fd = open(path, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); // I'm using the flags I saw glibc using.
|
||||||
|
if (fd >= 0)
|
||||||
|
return fd;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
char* mkdtemp(char* pattern)
|
char* mkdtemp(char* pattern)
|
||||||
{
|
{
|
||||||
int length = strlen(pattern);
|
int length = strlen(pattern);
|
||||||
|
|
|
@ -41,6 +41,7 @@ long labs(long);
|
||||||
double atof(const char*);
|
double atof(const char*);
|
||||||
int system(const char* command);
|
int system(const char* command);
|
||||||
char* mktemp(char*);
|
char* mktemp(char*);
|
||||||
|
int mkstemp(char*);
|
||||||
char* mkdtemp(char*);
|
char* mkdtemp(char*);
|
||||||
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*));
|
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*));
|
||||||
size_t mbstowcs(wchar_t*, const char*, size_t);
|
size_t mbstowcs(wchar_t*, const char*, size_t);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue