[file-roller] add a zero at the end of the buffer that contains the xml description
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller] add a zero at the end of the buffer that contains the xml description
- Date: Tue, 16 Oct 2012 18:01:14 +0000 (UTC)
commit 78d330c95a562f83769ace871b8c2671788842ba
Author: Paolo Bacchilega <paobac src gnome org>
Date: Tue Oct 16 19:58:58 2012 +0200
add a zero at the end of the buffer that contains the xml description
attempt to fix bug #686230
src/main.c | 37 ++++++++++++++++++++-----------------
1 files changed, 20 insertions(+), 17 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index e935311..1eb2e65 100644
--- a/src/main.c
+++ b/src/main.c
@@ -600,29 +600,32 @@ fr_application_register_archive_manager_service (FrApplication *self)
gsize size;
guchar *buffer;
GInputStream *stream;
+ gsize bytes_read;
GError *error = NULL;
g_application_hold (G_APPLICATION (self));
g_resources_get_info (ORG_GNOME_ARCHIVEMANAGER_XML, 0, &size, NULL, NULL);
- buffer = g_new (guchar, size);
+ buffer = g_new (guchar, size + 1);
stream = g_resources_open_stream (ORG_GNOME_ARCHIVEMANAGER_XML, 0, NULL);
- g_input_stream_read_all (stream, buffer, size, NULL, NULL, NULL);
-
- self->introspection_data = g_dbus_node_info_new_for_xml ((gchar *) buffer, &error);
- if (self->introspection_data != NULL) {
- self->owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
- "org.gnome.ArchiveManager1",
- G_BUS_NAME_OWNER_FLAGS_NONE,
- on_bus_acquired_for_archive_manager,
- NULL /*on_name_acquired*/,
- NULL /*on_name_lost*/,
- self,
- NULL);
- }
- else {
- g_warning ("%s", error->message);
- g_clear_error (&error);
+ if (g_input_stream_read_all (stream, buffer, size, &bytes_read, NULL, NULL)) {
+ buffer[bytes_read] = '\0';
+
+ self->introspection_data = g_dbus_node_info_new_for_xml ((gchar *) buffer, &error);
+ if (self->introspection_data != NULL) {
+ self->owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
+ "org.gnome.ArchiveManager1",
+ G_BUS_NAME_OWNER_FLAGS_NONE,
+ on_bus_acquired_for_archive_manager,
+ NULL /*on_name_acquired*/,
+ NULL /*on_name_lost*/,
+ self,
+ NULL);
+ }
+ else {
+ g_warning ("%s", error->message);
+ g_clear_error (&error);
+ }
}
g_timeout_add_seconds (SERVICE_TIMEOUT, service_timeout_cb, self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]