add checking code for fwrite, problem reported by Michal Marek
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8472 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ea0a0dde9e
commit
cbf3800960
1 changed files with 3 additions and 1 deletions
|
|
@ -71,7 +71,9 @@ static int
|
|||
File_write(DOH *fo, void *buffer, int len) {
|
||||
DohFile *f = (DohFile *) ObjData(fo);
|
||||
if (f->filep) {
|
||||
return fwrite(buffer,1,len,f->filep);
|
||||
int ret = (int) fwrite(buffer, 1, len, f->filep);
|
||||
int err = (ret != len) ? ferror(f->filep) : 0;
|
||||
return err ? -1: ret;
|
||||
} else if (f->fd) {
|
||||
#ifdef DOH_INTFILE
|
||||
return write(f->fd,buffer,len);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue