[vte] [stream] Fix bug in _head()



commit a1f8b0fb38291dd368b6a085aa2b6c5505024a2a
Author: Behdad Esfahbod <behdad behdad org>
Date:   Tue Sep 15 15:47:39 2009 -0400

    [stream] Fix bug in _head()

 src/vtestream-file.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/vtestream-file.h b/src/vtestream-file.h
index f9b7d7c..36a9fc1 100644
--- a/src/vtestream-file.h
+++ b/src/vtestream-file.h
@@ -27,7 +27,7 @@ _xread (int fd, char *data, gsize len)
 {
 	gsize ret, total = 0;
 
-	g_assert (fd);
+	g_assert (fd || !len);
 
 	while (len) {
 		ret = read (fd, data, len);
@@ -51,7 +51,7 @@ _xwrite (int fd, const char *data, gsize len)
 {
 	gsize ret;
 
-	g_assert (fd);
+	g_assert (fd || !len);
 
 	while (len) {
 		ret = write (fd, data, len);
@@ -73,7 +73,7 @@ _xtruncate (gint fd, gsize offset)
 {
 	int ret;
 
-	g_assert (fd);
+	g_assert (fd || !offset);
 
 	do {
 		ret = ftruncate (fd, offset);
@@ -237,7 +237,7 @@ _vte_file_stream_head (VteStream *astream)
 	VteFileStream *stream = (VteFileStream *) astream;
 
 	if (stream->fd[0])
-		return stream->offset[0] += lseek (stream->fd[0], 0, SEEK_END);
+		return stream->offset[0] + lseek (stream->fd[0], 0, SEEK_END);
 	else
 		return stream->offset[0];
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]