[byzanz] Fix (a correct) compile warning
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [byzanz] Fix (a correct) compile warning
- Date: Sun, 28 Feb 2010 17:49:31 +0000 (UTC)
commit fa015e2d6ffb8bd679ae9d1e8cc78871fe4f1559
Author: Benjamin Otte <otte redhat com>
Date: Sun Feb 28 18:47:54 2010 +0100
Fix (a correct) compile warning
The code would do bad things if the input stream was closed.
src/byzanzqueueoutputstream.c | 32 ++++++++++++++++++--------------
1 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/src/byzanzqueueoutputstream.c b/src/byzanzqueueoutputstream.c
index 311a206..f713bb5 100644
--- a/src/byzanzqueueoutputstream.c
+++ b/src/byzanzqueueoutputstream.c
@@ -60,6 +60,8 @@ byzanz_queue_output_stream_ensure_output (ByzanzQueueOutputStream *stream,
GError ** error)
{
GFile *file;
+ int fd;
+ char *filename;
if (stream->output_bytes == 0 && stream->output)
{
@@ -73,21 +75,23 @@ byzanz_queue_output_stream_ensure_output (ByzanzQueueOutputStream *stream,
return TRUE;
g_async_queue_lock (stream->queue->files);
- if (!stream->queue->input_closed) {
- int fd;
- char *filename;
-
- fd = g_file_open_tmp ("byzanzcacheXXXXXX", &filename, error);
- if (fd < 0) {
- file = NULL;
- } else {
- close (fd);
- file = g_file_new_for_path (filename);
- g_free (filename);
- g_object_ref (file);
- g_async_queue_push_unlocked (stream->queue->files, file);
- }
+
+ if (stream->queue->input_closed) {
+ g_async_queue_unlock (stream->queue->files);
+ return TRUE;
}
+
+ fd = g_file_open_tmp ("byzanzcacheXXXXXX", &filename, error);
+ if (fd < 0) {
+ file = NULL;
+ } else {
+ close (fd);
+ file = g_file_new_for_path (filename);
+ g_free (filename);
+ g_object_ref (file);
+ g_async_queue_push_unlocked (stream->queue->files, file);
+ }
+
g_async_queue_unlock (stream->queue->files);
if (file == NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]