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

psi: Allow opening of zero length files as empty images

+13 -1
+13 -1
src/drivers/psi/psi-img.c
··· 5 5 /***************************************************************************** 6 6 * File name: src/drivers/psi/psi-img.c * 7 7 * Created: 2012-02-14 by Hampa Hug <hampa@hampa.ch> * 8 - * Copyright: (C) 2012-2016 Hampa Hug <hampa@hampa.ch> * 8 + * Copyright: (C) 2012-2021 Hampa Hug <hampa@hampa.ch> * 9 9 *****************************************************************************/ 10 10 11 11 /***************************************************************************** ··· 116 116 117 117 psi_img_t *psi_load_fp (FILE *fp, unsigned type) 118 118 { 119 + int c; 120 + 121 + if ((c = fgetc (fp)) == EOF) { 122 + if (ferror (fp)) { 123 + return (NULL); 124 + } 125 + 126 + return (psi_img_new()); 127 + } 128 + 129 + ungetc (c, fp); 130 + 119 131 switch (type) { 120 132 case PSI_FORMAT_ANADISK: 121 133 return (psi_load_anadisk (fp));