comparison rogue4/save.c @ 182:1fe660009fd3

rogue4: don't try to close the scorefile if it isn't open. The MSVC library uses a debug assertion to prevent closing file descriptors that are negative. This is always the case with the scoreboard file descriptor if the scoreboard has been compiled out.
author John "Elwin" Edwards
date Fri, 31 Jul 2015 20:12:33 -0400
parents 8dd4b06a9155
children 1b73a8641b37
comparison
equal deleted inserted replaced
181:d53b13637783 182:1fe660009fd3
158 int scols = COLS; 158 int scols = COLS;
159 159
160 /* 160 /*
161 * close any open score file 161 * close any open score file
162 */ 162 */
163 close(fd); 163 if (fd >= 0) {
164 close(fd);
165 fd = -1;
166 }
164 move(LINES-1, 0); 167 move(LINES-1, 0);
165 refresh(); 168 refresh();
166 fstat(md_fileno(savef), &sbuf); 169 fstat(md_fileno(savef), &sbuf);
167 /* 170 /*
168 * DO NOT DELETE. This forces stdio to allocate the output buffer 171 * DO NOT DELETE. This forces stdio to allocate the output buffer