Hi, Mattias!
>Hi,
>
>is the following problem known? Sometimes (usually a few times a day :-(
>) if I press F4 to edit a .cc file with the internal editor, the
>Midnight Commander hangs up. Here is the description of the problem:
>
I cannot reproduce this, but it is possible if previous system call was
interrupted.
fgetc returns -1 on error and on end of file, so additional check needed.
>
>---
>404 for (;;) {
>405 c = fgetc (f);
>406 if (c == EOF) {
>407 if (errno == EINTR)
>408 continue;
>---
>
>It tries to read my own `c.syntax' (see the attachment). `c' and `errno'
>always have the same values: c is -1 and errno is EINTR. `f' has the
>following value (produced with `p *f' in the gdb):
>
Does patch below help you?
Regards,
Andrew.
--- syntax.c Wed Nov 28 17:17:37 2001
+++ syntax.c-1.19+ Mon Dec 17 10:09:15 2001
@@ -405,6 +405,8 @@ static int read_one_line (char **line, F
for (;;) {
c = fgetc (f);
if (c == EOF) {
+ if (feof (f))
+ break;
if (errno == EINTR)
continue;
r = 0;