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
0a8d90e164
commit
533e3842dc
|
|
@ -282,12 +282,11 @@ dosim(
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#else
|
#else
|
||||||
else if (!(rawfileFp = fopen(wl->wl_word, "w"))) {
|
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);
|
perror(wl->wl_word);
|
||||||
ft_setflag = FALSE;
|
ft_setflag = FALSE;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
||||||
#endif /* __MINGW32__ */
|
#endif /* __MINGW32__ */
|
||||||
rawfileBinary = !ascii;
|
rawfileBinary = !ascii;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -110,28 +110,27 @@ com_resume(wordlist *wl)
|
||||||
/* ask if binary or ASCII, open file with w or wb hvogt 15.3.2000 */
|
/* ask if binary or ASCII, open file with w or wb hvogt 15.3.2000 */
|
||||||
else if (ascii) {
|
else if (ascii) {
|
||||||
if ((rawfileFp = fopen(last_used_rawfile, "a")) == NULL) {
|
if ((rawfileFp = fopen(last_used_rawfile, "a")) == NULL) {
|
||||||
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
|
||||||
perror(last_used_rawfile);
|
perror(last_used_rawfile);
|
||||||
ft_setflag = FALSE;
|
ft_setflag = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
||||||
} else if (!ascii) {
|
} else if (!ascii) {
|
||||||
if ((rawfileFp = fopen(last_used_rawfile, "ab")) == NULL) {
|
if ((rawfileFp = fopen(last_used_rawfile, "ab")) == NULL) {
|
||||||
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
|
||||||
perror(last_used_rawfile);
|
perror(last_used_rawfile);
|
||||||
ft_setflag = FALSE;
|
ft_setflag = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#else
|
#else
|
||||||
else if (!(rawfileFp = fopen(last_used_rawfile, "a"))) {
|
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);
|
perror(last_used_rawfile);
|
||||||
ft_setflag = FALSE;
|
ft_setflag = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
||||||
#endif
|
#endif
|
||||||
rawfileBinary = !ascii;
|
rawfileBinary = !ascii;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue