aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Hill <kyle.hill@tacomafia.net>2012-08-29 08:40:06 -0500
committerKyle Hill <kyle.hill@tacomafia.net>2012-09-01 09:38:41 -0500
commit1eb288891428690ebe50621f76936775fcb43979 (patch)
tree8ed9d92473bfc541428b3c6d9d815720ad089ed0
parent82ec3990456971f9410c266265a34fb42814ca49 (diff)
Check return of stat() syscall in XBMCTex.cpp
-rw-r--r--tools/TexturePacker/XBMCTex.cpp43
1 files changed, 22 insertions, 21 deletions
diff --git a/tools/TexturePacker/XBMCTex.cpp b/tools/TexturePacker/XBMCTex.cpp
index 63da7486ab..8db78eb873 100644
--- a/tools/TexturePacker/XBMCTex.cpp
+++ b/tools/TexturePacker/XBMCTex.cpp
@@ -143,32 +143,33 @@ void CreateSkeletonHeaderImpl(CXBTF& xbtf, std::string fullPath, std::string rel
//stat to check for dir type (reiserfs fix)
std::string fileN = fullPath + "/" + dp->d_name;
- stat(fileN.c_str(), &stat_p);
-
- if (dp->d_type == DT_DIR || stat_p.st_mode & S_IFDIR)
+ if (stat(fileN.c_str(), &stat_p) == 0)
{
- std::string tmpPath = relativePath;
- if (tmpPath.size() > 0)
+ if (dp->d_type == DT_DIR || stat_p.st_mode & S_IFDIR)
{
- tmpPath += "/";
- }
+ std::string tmpPath = relativePath;
+ if (tmpPath.size() > 0)
+ {
+ tmpPath += "/";
+ }
- CreateSkeletonHeaderImpl(xbtf, fullPath + DIR_SEPARATOR + dp->d_name, tmpPath + dp->d_name);
- }
- else if (IsGraphicsFile(dp->d_name))
- {
- std::string fileName = "";
- if (relativePath.size() > 0)
+ CreateSkeletonHeaderImpl(xbtf, fullPath + DIR_SEPARATOR + dp->d_name, tmpPath + dp->d_name);
+ }
+ else if (IsGraphicsFile(dp->d_name))
{
- fileName += relativePath;
- fileName += "/";
+ std::string fileName = "";
+ if (relativePath.size() > 0)
+ {
+ fileName += relativePath;
+ fileName += "/";
+ }
+
+ fileName += dp->d_name;
+
+ CXBTFFile file;
+ file.SetPath(fileName);
+ xbtf.GetFiles().push_back(file);
}
-
- fileName += dp->d_name;
-
- CXBTFFile file;
- file.SetPath(fileName);
- xbtf.GetFiles().push_back(file);
}
}