Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnome.org>2008-04-01 02:22:08 +0400
committerMiguel de Icaza <miguel@gnome.org>2008-04-01 02:22:08 +0400
commit86e1e90c83aa8aa497343f4fb9a40ba249f4b0a8 (patch)
treecac68622bfc031fb949596e29254f294f52d49ff /support
parent42434ae85f0fa0ff8a2f50172bdca7178343b094 (diff)
2008-03-31 Miguel de Icaza <miguel@novell.com>
* serial.c (write_serial): Avoid infinite loops, see #375580. svn path=/trunk/mono/; revision=99480
Diffstat (limited to 'support')
-rw-r--r--support/ChangeLog4
-rw-r--r--support/serial.c11
2 files changed, 12 insertions, 3 deletions
diff --git a/support/ChangeLog b/support/ChangeLog
index 1b719cb6d07..424d27243fa 100644
--- a/support/ChangeLog
+++ b/support/ChangeLog
@@ -1,3 +1,7 @@
+2008-03-31 Miguel de Icaza <miguel@novell.com>
+
+ * serial.c (write_serial): Avoid infinite loops, see #375580.
+
2008-02-12 Jonathan Pryor <jpryor@novell.com>
* signal.c: SLES9 has glib 2.2, so we can't rely on g_atomic_int_*().
diff --git a/support/serial.c b/support/serial.c
index 9443e0bb923..4775805aaf5 100644
--- a/support/serial.c
+++ b/support/serial.c
@@ -95,7 +95,7 @@ write_serial (int fd, guchar *buffer, int offset, int count, int timeout)
fd_set writefs;
guint32 n;
- n = count - offset;
+ n = count;
FD_SET(fd, &writefs);
tmval.tv_sec = timeout / 1000;
@@ -113,7 +113,12 @@ write_serial (int fd, guchar *buffer, int offset, int count, int timeout)
}
}
- t = write(fd, buffer + offset, count);
+ do {
+ t = write (fd, buffer + offset, n);
+ } while (t == -1 && errno == EINTR);
+
+ if (t < 0)
+ return -1;
if (timeout > 0)
{
@@ -121,7 +126,7 @@ write_serial (int fd, guchar *buffer, int offset, int count, int timeout)
{
return -1;
}
- }
+ }
offset += t;
n -= t;