diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2020-06-13 12:52:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-13 12:52:41 (GMT) |
commit | 4aabbf52e57692ebea122f50c8e8a75832db7f86 (patch) | |
tree | 9888cba6a5ae5e1fdead960b307e4e99337be95d | |
parent | 77dc437c81a06cae058755d60a43f03dc43f367e (diff) | |
parent | e6a6e65d46196125a5baad4aeb1942aa043236fa (diff) | |
download | Doxygen-4aabbf52e57692ebea122f50c8e8a75832db7f86.zip Doxygen-4aabbf52e57692ebea122f50c8e8a75832db7f86.tar.gz Doxygen-4aabbf52e57692ebea122f50c8e8a75832db7f86.tar.bz2 |
Merge pull request #7843 from albert-github/feature/bug_coverity_mkdir
Catch all wrong mkdir calls (coverity)
-rw-r--r-- | src/cite.cpp | 6 | ||||
-rw-r--r-- | src/context.cpp | 2 | ||||
-rw-r--r-- | src/template.cpp | 6 | ||||
-rw-r--r-- | src/util.cpp | 10 |
4 files changed, 19 insertions, 5 deletions
diff --git a/src/cite.cpp b/src/cite.cpp index 4adf6f2..82f9e6d 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -203,7 +203,11 @@ void CitationManager::generatePage() QCString bibOutputDir = outputDir+"/"+bibTmpDir; QCString bibOutputFiles = ""; QDir thisDir; - thisDir.mkdir(bibOutputDir); + if (!thisDir.exists(bibOutputDir) && !thisDir.mkdir(bibOutputDir)) + { + err("Failed to create temorary output directory '%s', skiping citations\n",bibOutputDir.data()); + return; + } int i = 0; for (const auto &bibdata : citeDataList) { diff --git a/src/context.cpp b/src/context.cpp index d21b1d0..3d71706 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -10343,7 +10343,7 @@ void generateTemplateFiles(const char *templateDir) QCString outDir = QCString(templateDir)+"/html"; if (!thisDir.exists(outDir) && !thisDir.mkdir(outDir)) { - err("Failed to create output directory '%s'\n",templateDir); + err("Failed to create output directory '%s'\n",outDir.data()); return; } ResourceMgr::instance().writeCategory("html",outDir); diff --git a/src/template.cpp b/src/template.cpp index 1763eec..c836c6b 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -2843,7 +2843,11 @@ template<class T> class TemplateNodeCreator : public TemplateNode if (d.exists()) { bool ok = d.mkdir(fileName.mid(j,i-j)); - if (!ok) break; + if (!ok) + { + err("Failed to create directory '%s'\n",(fileName.mid(j,i-j)).data()); + break; + } QCString dirName = outputDir+'/'+fileName.left(i); d = QDir(dirName); j = i+1; diff --git a/src/util.cpp b/src/util.cpp index 7006f26..1624b1c 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -5022,10 +5022,16 @@ void createSubDirs(QDir &d) int l1,l2; for (l1=0;l1<16;l1++) { - d.mkdir(QCString().sprintf("d%x",l1)); + if (!d.mkdir(QCString().sprintf("d%x",l1))) + { + term("Failed to create output directory '%s'\n",(QCString().sprintf("d%x",l1)).data()); + } for (l2=0;l2<256;l2++) { - d.mkdir(QCString().sprintf("d%x/d%02x",l1,l2)); + if (!d.mkdir(QCString().sprintf("d%x/d%02x",l1,l2))) + { + term("Failed to create output directory '%s'\n",(QCString().sprintf("d%x/d%02x",l1,l2)).data()); + } } } } |