check mkdir results (coverity 1109838)

This commit is contained in:
Vincent Sanders 2014-05-18 11:15:07 +01:00
parent e197abf63a
commit 17b347a260
1 changed files with 8 additions and 1 deletions

View File

@ -457,13 +457,20 @@ char *container_extract_theme(const char *themefile, const char *dirbasename)
strcpy(dirname, dirbasename);
strcat(dirname, themename);
if (stat(dirname, &statbuf) != -1) {
/* directory exists */
warn_user("DirectoryError", dirname);
container_close(cctx);
free(dirname);
free(themename);
return NULL;
}
if (mkdir(dirname, S_IRWXU) != 0) {
warn_user("DirectoryError", dirname);
container_close(cctx);
free(dirname);
free(themename);
return NULL;
}
mkdir(dirname, S_IRWXU);
for (e = container_iterate(cctx, &state), i = 0; i < cctx->entries;
e = container_iterate(cctx, &state), i++) {