diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-04 21:30:47 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-04 21:30:47 +0400 |
commit | d2dbc0b85eccd5989286c063b94f78f18992d3df (patch) | |
tree | 6f731bc07b271fba8922d3fce61e3fdc462eacda /source/blender/blenloader | |
parent | aa43a978c187e6f9e941279f7393cdc2eb399212 (diff) |
more consistent use of checks of BLI_open(), check 'fd < 0' rather then -1. packedfile incorrectly treated 0 as an error value. best not be vague/sloppy with this.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/runtime.c | 4 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/blenloader/intern/runtime.c b/source/blender/blenloader/intern/runtime.c index d6fd2f92443..ca9f2faf998 100644 --- a/source/blender/blenloader/intern/runtime.c +++ b/source/blender/blenloader/intern/runtime.c @@ -72,7 +72,7 @@ int BLO_is_a_runtime(const char *path) int datastart; char buf[8]; - if (fd == -1) + if (fd < 0) goto cleanup; lseek(fd, -12, SEEK_END); @@ -104,7 +104,7 @@ BlendFileData *BLO_read_runtime(const char *path, ReportList *reports) fd = BLI_open(path, O_BINARY | O_RDONLY, 0); - if (fd == -1) { + if (fd < 0) { BKE_reportf(reports, RPT_ERROR, "Unable to open '%s': %s", path, strerror(errno)); goto cleanup; } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 12804e8042d..dc4b1d48ce5 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -3396,7 +3396,7 @@ int BLO_write_file(Main *mainvar, const char *filepath, int write_flags, ReportL BLI_snprintf(tempname, sizeof(tempname), "%s@", filepath); file = BLI_open(tempname, O_BINARY+O_WRONLY+O_CREAT+O_TRUNC, 0666); - if (file == -1) { + if (file < 0) { BKE_reportf(reports, RPT_ERROR, "Cannot open file %s for writing: %s", tempname, strerror(errno)); return 0; } |