mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 14:22:28 +00:00
Normalize mkdir() error codes
This commit is contained in:
parent
6070319f84
commit
bf8b1623c8
11 changed files with 206 additions and 25 deletions
|
@ -32,7 +32,7 @@ static int rmrfdir(const char *dirpath) {
|
|||
char *path;
|
||||
struct dirent *e;
|
||||
if (!(d = opendir(dirpath))) return -1;
|
||||
for (rc = 0; (e = readdir(d));) {
|
||||
while ((e = readdir(d))) {
|
||||
if (!strcmp(e->d_name, ".")) continue;
|
||||
if (!strcmp(e->d_name, "..")) continue;
|
||||
if (strchr(e->d_name, '/')) abort();
|
||||
|
@ -44,7 +44,9 @@ static int rmrfdir(const char *dirpath) {
|
|||
}
|
||||
free(path);
|
||||
}
|
||||
return closedir(d);
|
||||
rc = closedir(d);
|
||||
rc |= rmdir(dirpath);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue