Browse Source

prevent pass null pointer into setvbuf

pre-master-46
dwarning 8 years ago
committed by Holger Vogt
parent
commit
6b99bc8f7a
  1. 1
      src/frontend/runcoms.c
  2. 1
      src/frontend/runcoms2.c

1
src/frontend/runcoms.c

@ -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;

1
src/frontend/runcoms2.c

@ -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;

Loading…
Cancel
Save