summaryrefslogtreecommitdiff
path: root/src/bacon-message-connection.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2003-04-09 22:31:38 +0000
committerBastien Nocera <hadess@src.gnome.org>2003-04-09 22:31:38 +0000
commit40050dd430b90762af2981ff7862786ec8a8df1c (patch)
tree3f7d36e087d138ae65e105c1e5cef43d8c51911c /src/bacon-message-connection.c
parente69cf01d8bb6cc4eac63dee62792c6b3bf298a20 (diff)
upd update to get a bug fix by Ross Burton fix a buf which would make
2003-04-09 Bastien Nocera <hadess@hadess.net> * README: upd * src/bacon-cd-selection.c: (bacon_cd_selection_get_device): update to get a bug fix by Ross Burton * src/bacon-message-connection.c: (server_cb), (bacon_message_connection_send): fix a buf which would make Totem receive only the first file of a list of them * src/totem.c: (process_command_line): make it work (better)
Diffstat (limited to 'src/bacon-message-connection.c')
-rw-r--r--src/bacon-message-connection.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/bacon-message-connection.c b/src/bacon-message-connection.c
index 15d2bca4..35a64cb9 100644
--- a/src/bacon-message-connection.c
+++ b/src/bacon-message-connection.c
@@ -62,8 +62,9 @@ static gboolean
server_cb (GIOChannel *source, GIOCondition condition, gpointer data)
{
BaconMessageConnection *conn = (BaconMessageConnection *)data;
- char *message, buf[BUF_SIZE];
+ char *message, *subs, buf[BUF_SIZE];
int cd, alen, rc, offset;
+ gboolean finished;
message = NULL;
offset = 0;
@@ -71,7 +72,7 @@ server_cb (GIOChannel *source, GIOCondition condition, gpointer data)
memset (buf, sizeof (buf), '\0');
rc = read (cd, buf, BUF_SIZE);
-
+//FIXME test for the actual errno
while (rc != 0)
{
message = g_realloc (message, rc + offset);
@@ -82,8 +83,18 @@ server_cb (GIOChannel *source, GIOCondition condition, gpointer data)
rc = read (cd, buf, BUF_SIZE);
}
- if (message != NULL && conn->func != NULL)
- (*conn->func) (message, conn->data);
+ subs = message;
+ finished = FALSE;
+
+ while (subs != '\0' && finished == FALSE)
+ {
+ if (message != NULL && conn->func != NULL)
+ (*conn->func) (subs, conn->data);
+
+ subs += strlen (subs) + 1;
+ if (subs - message >= offset)
+ finished = TRUE;
+ }
g_free (message);
@@ -222,7 +233,7 @@ bacon_message_connection_send (BaconMessageConnection *conn,
{
g_return_if_fail (conn != NULL);
g_assert (conn->is_server == FALSE);
-
+//FIXME test short writes
write (conn->fd, message, strlen (message) + 1);
}