prevent pass null pointer into setvbuf

This commit is contained in:
dwarning 2018-10-25 10:49:21 +02:00 committed by Holger Vogt
parent 93f35afe69
commit 6b99bc8f7a
2 changed files with 2 additions and 0 deletions

View File

@ -282,6 +282,7 @@ 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;

View File

@ -126,6 +126,7 @@ com_resume(wordlist *wl)
/*---------------------------------------------------------------------------*/
#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;