summaryrefslogtreecommitdiff
path: root/fileutils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fileutils.cpp')
-rw-r--r--fileutils.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/fileutils.cpp b/fileutils.cpp
index 9ac3e6d..39a7dca 100644
--- a/fileutils.cpp
+++ b/fileutils.cpp
@@ -42,15 +42,17 @@ int FileUtils::deltree(const char* directory)
continue;
}
struct stat info;
- stat(entry->d_name, &info);
+ if (stat(entry->d_name, &info) != 0) {
+ return -1;
+ }
+ string pathName = string(directory) + "/" + string(entry->d_name);
if (S_ISDIR(info.st_mode)) {
- if (deltree(entry->d_name)) {
+ if (deltree(pathName.c_str())) {
ret = -1;
}
- rmdir(entry->d_name);
+ rmdir(pathName.c_str());
} else {
- string file = string(directory) + "/" + string(entry->d_name);
- if (unlink(file.c_str())) {
+ if (unlink(pathName.c_str())) {
ret = -1;
}
}

Generated by cgit