Skip to content

Commit

Permalink
ccon: Check for failed strdup in mkdir_all
Browse files Browse the repository at this point in the history
  • Loading branch information
wking committed Feb 27, 2018
1 parent de0d322 commit 766d926
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ccon.c
Original file line number Diff line number Diff line change
Expand Up @@ -2610,6 +2610,11 @@ static int mkdir_all(const char *path, mode_t mode)
if (stat(path, &buf) == -1) {
if (errno == ENOENT) {
path_copy = strdup(path);
if (path_copy == NULL) {
PERROR("strdup");
err = -1;
goto cleanup;
}
dir = dirname(path_copy);
if (mkdir_all(dir, mode) == -1) {
err = -1;
Expand Down

0 comments on commit 766d926

Please sign in to comment.