prevent pass null pointer into setvbuf
This commit is contained in:
parent
93f35afe69
commit
6b99bc8f7a
|
|
@ -282,6 +282,7 @@ 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);
|
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
||||||
perror(wl->wl_word);
|
perror(wl->wl_word);
|
||||||
ft_setflag = FALSE;
|
ft_setflag = FALSE;
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,7 @@ com_resume(wordlist *wl)
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#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);
|
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
|
||||||
perror(last_used_rawfile);
|
perror(last_used_rawfile);
|
||||||
ft_setflag = FALSE;
|
ft_setflag = FALSE;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue