Exemplo n.º 1
0
static gboolean
server_socket_in_event(G_GNUC_UNUSED GIOChannel *source,
		       G_GNUC_UNUSED GIOCondition condition,
		       gpointer data)
{
	struct one_socket *s = data;

	struct sockaddr_storage address;
	size_t address_length = sizeof(address);
	int fd = accept_cloexec_nonblock(s->fd, (struct sockaddr*)&address,
					 &address_length);
	if (fd >= 0)
		s->parent->callback(fd, (const struct sockaddr*)&address,
				    address_length, get_remote_uid(fd),
				    s->parent->callback_ctx);
	else
		g_warning("accept() failed: %s", g_strerror(errno));

	return true;
}
Exemplo n.º 2
0
static int handle_DeleteDebugDump(DBusMessage* call, DBusMessage* reply)
{
    int r;
    DBusMessageIter in_iter;
    dbus_message_iter_init(call, &in_iter);
    const char* crash_id;
    r = load_charp(&in_iter, &crash_id);
    if (r != ABRT_DBUS_LAST_FIELD)
    {
        error_msg("dbus call %s: parameter type mismatch", __func__ + 7);
        return -1;
    }

    long unix_uid = get_remote_uid(call, NULL);
    int32_t result = DeleteDebugDump(crash_id, unix_uid);

    DBusMessageIter out_iter;
    dbus_message_iter_init_append(reply, &out_iter);
    store_int32(&out_iter, result);

    send_flush_and_unref(reply);
    return 0;
}