Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sagiegurari committed Sep 24, 2020
1 parent 52fb6c8 commit 76e4722
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/fsio.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,14 @@ bool _write_text_file(char *file, char *text, char *mode)
return(false);
}

char *file_clone = strdup(file);
char *directory = dirname(file_clone);
if (!fsio_mkdirs(directory, S_IRWXU | S_IRWXG))
char *file_clone = strdup(file);
char *directory = dirname(file_clone);
bool directory_created = fsio_mkdirs(directory, S_IRWXU | S_IRWXG);
free(file_clone);
if (!directory_created)
{
return(false);
}
free(file_clone);

FILE *fp = fopen(file, mode);
if (fp == NULL)
Expand Down

0 comments on commit 76e4722

Please sign in to comment.