fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

lib: Check return value of fgetc() in console.c

Hampa Hug 517d4f83 35151966

+7 -3
+7 -3
src/lib/console.c
··· 5 5 /***************************************************************************** 6 6 * File name: src/lib/console.c * 7 7 * Created: 2006-06-19 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 2006-2009 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 2006-2010 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 107 107 str[0] = 0; 108 108 109 109 if (pce_redir_inp != NULL) { 110 - fgets (str, max, pce_redir_inp); 110 + if (fgets (str, max, pce_redir_inp) == NULL) { 111 + str[0] = 0; 112 + } 111 113 112 114 if (str[0] != 0) { 113 115 pce_puts (str); ··· 146 148 pce_puts (prompt); 147 149 } 148 150 149 - fgets (str, max, pce_fp_inp); 151 + if (fgets (str, max, pce_fp_inp) == NULL) { 152 + str[0] = 0; 153 + } 150 154 #endif 151 155 152 156 if (pce_redir_out != NULL) {