In case the file open failed we have no need to set the IO buffer size.
And this should also not be done with a NULL pointer into setvbuf.
This commit is contained in:
parent
5590406acf
commit
f0f19f87a3
|
|
@ -282,12 +282,11 @@ dosim(
|
|||
/*---------------------------------------------------------------------------*/
|
||||
#else
|
||||
else if (!(rawfileFp = fopen(wl->wl_word, "w"))) {
|
||||
rawfileFp = stdout; /* If fopen has failed, we have to proceed with stdout */
|
||||
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
||||
perror(wl->wl_word);
|
||||
ft_setflag = FALSE;
|
||||
return 1;
|
||||
}
|
||||
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
||||
#endif /* __MINGW32__ */
|
||||
rawfileBinary = !ascii;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -110,28 +110,27 @@ com_resume(wordlist *wl)
|
|||
/* ask if binary or ASCII, open file with w or wb hvogt 15.3.2000 */
|
||||
else if (ascii) {
|
||||
if ((rawfileFp = fopen(last_used_rawfile, "a")) == NULL) {
|
||||
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
||||
perror(last_used_rawfile);
|
||||
ft_setflag = FALSE;
|
||||
return;
|
||||
}
|
||||
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
||||
} else if (!ascii) {
|
||||
if ((rawfileFp = fopen(last_used_rawfile, "ab")) == NULL) {
|
||||
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
||||
perror(last_used_rawfile);
|
||||
ft_setflag = FALSE;
|
||||
return;
|
||||
}
|
||||
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#else
|
||||
else if (!(rawfileFp = fopen(last_used_rawfile, "a"))) {
|
||||
rawfileFp = stdout; /* If fopen has failed, we have to proceed with stdout */
|
||||
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
||||
perror(last_used_rawfile);
|
||||
ft_setflag = FALSE;
|
||||
return;
|
||||
}
|
||||
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
||||
#endif
|
||||
rawfileBinary = !ascii;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue