[vte] Bug 596365 - libvte crashes when issueing 'reset' in a terminal
- From: Behdad Esfahbod <behdad src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vte] Bug 596365 - libvte crashes when issueing 'reset' in a terminal
- Date: Fri, 25 Sep 2009 20:56:06 +0000 (UTC)
commit 73aba0352cd8034f69178459fc58347cedc74ec7
Author: Behdad Esfahbod <behdad behdad org>
Date: Fri Sep 25 16:55:08 2009 -0400
Bug 596365 - libvte crashes when issueing 'reset' in a terminal
src/vtestream-file.h | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/vtestream-file.h b/src/vtestream-file.h
index 1fca565..1701af3 100644
--- a/src/vtestream-file.h
+++ b/src/vtestream-file.h
@@ -27,7 +27,8 @@ _xread (int fd, char *data, gsize len)
{
gsize ret, total = 0;
- g_assert (fd || !len);
+ if (G_UNLIKELY (len && !fd))
+ return 0;
while (len) {
ret = read (fd, data, len);
@@ -73,7 +74,8 @@ _xtruncate (gint fd, gsize offset)
{
int ret;
- g_assert (fd || !offset);
+ if (G_UNLIKELY (!fd))
+ return;
do {
ret = ftruncate (fd, offset);
@@ -224,8 +226,7 @@ _vte_file_stream_new_page (VteStream *astream)
if (stream->fd[0])
stream->offset[0] += lseek (stream->fd[0], 0, SEEK_END);
_vte_file_stream_swap_fds (stream);
- if (stream->fd[0])
- _xtruncate (stream->fd[0], 0);
+ _xtruncate (stream->fd[0], 0);
}
static gsize
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]