Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-02-17 23:26:10 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-02-17 23:27:27 +0300
commita9dbaf3755ac1abad109970e0fff190bb7418ac2 (patch)
tree7c3382bd34b97cfb6a41d4065a6b6cd8fca2c1cc /source/blender/blenkernel
parente089b0e91162fb0932bdb88e9905cdd9fb6b94dd (diff)
Ensure BLI_stat() return value is checked.
also add function attrs on BLI_fileops to ensure they're used correctly.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/bpath.c2
-rw-r--r--source/blender/blenkernel/intern/packedFile.c2
-rw-r--r--source/blender/blenkernel/intern/text.c16
3 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index fc3c1a20700..3488cff7315 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -233,7 +233,7 @@ static int findFileRecursive(char *filename_new,
BLI_join_dirfile(path, sizeof(path), dirname, de->d_name);
- if (BLI_stat(path, &status) != 0)
+ if (BLI_stat(path, &status) == -1)
continue; /* cant stat, don't bother with this file, could print debug info here */
if (S_ISREG(status.st_mode)) { /* is file */
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index d186b4299a5..b989bb2760f 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -376,7 +376,7 @@ int checkPackedFile(const char *filename, PackedFile *pf)
BLI_strncpy(name, filename, sizeof(name));
BLI_path_abs(name, G.main->name);
- if (BLI_stat(name, &st)) {
+ if (BLI_stat(name, &st) == -1) {
ret_val = PF_NOFILE;
}
else if (st.st_size != pf->size) {
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index c5a8cbe68b2..9f441b45db9 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -375,8 +375,12 @@ int BKE_text_reload(Text *text)
fclose(fp);
- BLI_stat(str, &st);
- text->mtime = st.st_mtime;
+ if (BLI_stat(str, &st) != -1) {
+ text->mtime = st.st_mtime;
+ }
+ else {
+ text->mtime = 0;
+ }
text_from_buf(text, buffer, len);
@@ -431,8 +435,12 @@ Text *BKE_text_load_ex(Main *bmain, const char *file, const char *relpath, const
fclose(fp);
- BLI_stat(str, &st);
- ta->mtime = st.st_mtime;
+ if (BLI_stat(str, &st) != -1) {
+ ta->mtime = st.st_mtime;
+ }
+ else {
+ ta->mtime = 0;
+ }
text_from_buf(ta, buffer, len);