mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-13 22:49:11 +00:00
Fix race condition in makedirs()
This commit is contained in:
parent
b7c07d548c
commit
571c2c3c69
7 changed files with 90 additions and 10 deletions
|
@ -17,12 +17,16 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/x/x.h"
|
||||
|
||||
/**
|
||||
* Returns directory portion of path.
|
||||
*/
|
||||
char *xdirname(const char *path) {
|
||||
return xstrdup(dirname(gc(xstrdup(path))));
|
||||
char *dirp;
|
||||
path = xstrdup(path);
|
||||
dirp = xstrdup(dirname(path));
|
||||
free(path);
|
||||
return dirp;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue