Skip to content

Commit

Permalink
Fixed root path mkdirs invocation and existing directory error detection
Browse files Browse the repository at this point in the history
  • Loading branch information
sagiegurari committed Dec 9, 2020
1 parent 1a6a609 commit b75b0e0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## CHANGELOG

### v0.1.4 (2020-12-09)

* Fixed root path mkdirs invocation.
* Fixed existing directory error detection.

### v0.1.3 (2020-11-27)

* New fsio_remove function.
Expand Down
11 changes: 7 additions & 4 deletions src/fsio.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ bool fsio_mkdir(char *directory, mode_t mode)

int result = mkdir(directory, mode);

if (result == 0 || result == EEXIST)
if (result == 0 || errno == EEXIST)
{
return(true);
}
Expand Down Expand Up @@ -169,10 +169,13 @@ bool fsio_mkdirs(char *directory, mode_t mode)
{
*path = '\0';

if (!fsio_mkdir(directory_mutable, mode))
if (strlen(directory_mutable))
{
free(directory_mutable);
return(false);
if (!fsio_mkdir(directory_mutable, mode))
{
free(directory_mutable);
return(false);
}
}

*path = '/';
Expand Down

0 comments on commit b75b0e0

Please sign in to comment.