[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] FreeMiNT 1.18 release
On 01/26/13 12:03, Alan Hourihane wrote:
On 01/26/13 11:02, Helmut Karlowski wrote:
Alan Hourihane, 26.01.2013 01:41:56:
Why this specific version of toswin2, what's wrong with the one in the
trunk code ?
That's only for 000, and compiled with -O0 AFAIK. But the latest
trunk-toswin also suffers from this.
Can someone who is experiencing this problem try this patch ?
No change, at least with my optimized toswin-version.
Any chance you can try this one ?
Actually, there's another nasty place that Fread isn't checked. Updated
patch attached.
Sorry I can't test these, I just can't reproduce here at the minute.
Alan.
Index: proc.c
===================================================================
RCS file: /mint/freemint/tools/toswin2/proc.c,v
retrieving revision 1.11
diff -u -r1.11 proc.c
--- proc.c 22 Jan 2008 13:42:46 -0000 1.11
+++ proc.c 26 Jan 2013 12:12:44 -0000
@@ -403,6 +403,7 @@
if (fdmask)
{
+again:
readfds = fdmask;
if ((r = Fselect(1, &readfds, 0L, 0L)) > 0)
{
@@ -416,19 +417,23 @@
continue;
if (readfds & (1L << t->fd))
{
- long int read_bytes =
- Fread(t->fd, (long)READBUFSIZ, buf);
- if (read_bytes > 0)
+ while ((r = Fread(t->fd, (long)READBUFSIZ, buf)) == EINTR);
+ if (r > 0)
{
- write_text(t, buf, read_bytes);
+ write_text(t, buf, r);
if (t->fd == con_fd)
- handle_console(buf, read_bytes);
+ handle_console(buf, r);
}
else
checkdead |= (1L << t->fd);
}
}
}
+
+ /* Select was interrupted, try again. */
+ if (r == -EINTR)
+ goto again;
+
if (checkdead)
rebuild_fdmask(checkdead);
}
Index: textwin.c
===================================================================
RCS file: /mint/freemint/tools/toswin2/textwin.c,v
retrieving revision 1.34
diff -u -r1.34 textwin.c
--- textwin.c 17 Jun 2011 16:23:18 -0000 1.34
+++ textwin.c 26 Jan 2013 12:12:44 -0000
@@ -1602,9 +1602,11 @@
r = Foutstat(t->fd);
if (r <= 0)
{
- r = Fread(t->fd, (long)READBUFSIZ, buf);
- write_text(t, buf, r);
- (void)Fselect(500, 0L, 0L, 0L);
+ while((r = Fread(t->fd, (long)READBUFSIZ, buf)) == EINTR);
+ if (r > 0) {
+ write_text(t, buf, r);
+ (void)Fselect(500, 0L, 0L, 0L);
+ }
r = Foutstat(t->fd);
}
if (r > 0)