~ubuntu-branches/debian/sid/upstart/sid

« back to all changes in this revision

Viewing changes to nih-dbus-tool/tests/expected/test_method_reply_function_array.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2010-06-19 21:15:12 UTC
  • mfrom: (1.3.2 upstream) (0.1.1280 upstart)
  • Revision ID: james.westby@ubuntu.com-20100619211512-cu6b20sf8qmm4oek
Tags: 0.6.6-1
* New upstream release.
  - Mount /proc and /sys on initialisation. Closes: #577710
  - Since version 0.6.5 upstart no longer includes a internal copy of libnih
    but instead depends on it being installed system wide.
  - Provide a separate function to reconnect to the D-Bus system bus which
    can be triggered by the SIGUSR1 signal as a config reload has the
    negative side effect of losing state.
* debian/control
  - Add Build-Depends on libnih-dev (>= 1.0.2), libnih-dbus-dev (>= 1.0.2)
    and nih-dbus-tool.
  - Bump Standards-Version to 3.8.4. No further changes.
  - Add ${misc:Depends}.
* debian/conf/dbus-reconnect.conf
  - Use SIGUSR1 to tell upstart to reconnect to the D-Bus system bus.
* debian/upstart.docs
  - Remove ChangeLog.nih which is no longer included in the source.
* debian/conf/tty*.conf
  - Run getty in 8-bit clean mode to better handle UTF-8 environments.
* Switch to source format 3.0 (quilt).
  - Drop Build-Depends on quilt.
  - Remove quilt.make include and patch/unpatch targets from debian/rules.
  - Add debian/source/format.
* Add SELinux support. Closes: #543420
  - Add debian/patches/01-selinux.patch to make upstart load the policy if
    SELinux is enabled. Patch by Russell Coker with some minor changes and
    build system integration.
  - Add debian/patches/99-autoreconf.patch.
  - Add Build-Depends on libselinux-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
int
2
 
my_async_method_reply (NihDBusMessage *message,
3
 
                       const int32_t * output,
4
 
                       size_t          output_len)
5
 
{
6
 
        DBusMessage *   reply;
7
 
        DBusMessageIter iter;
8
 
        DBusMessageIter output_iter;
9
 
 
10
 
        nih_assert (message != NULL);
11
 
        nih_assert ((output_len == 0) || (output != NULL));
12
 
 
13
 
        /* If the sender doesn't care about a reply, don't bother wasting
14
 
         * effort constructing and sending one.
15
 
         */
16
 
        if (dbus_message_get_no_reply (message->message))
17
 
                return 0;
18
 
 
19
 
        /* Construct the reply message. */
20
 
        reply = dbus_message_new_method_return (message->message);
21
 
        if (! reply)
22
 
                return -1;
23
 
 
24
 
        dbus_message_iter_init_append (reply, &iter);
25
 
 
26
 
        /* Marshal an array onto the message */
27
 
        if (! dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "i", &output_iter)) {
28
 
                dbus_message_unref (reply);
29
 
                return -1;
30
 
        }
31
 
 
32
 
        for (size_t output_i = 0; output_i < output_len; output_i++) {
33
 
                int32_t output_element;
34
 
 
35
 
                output_element = output[output_i];
36
 
 
37
 
                /* Marshal a int32_t onto the message */
38
 
                if (! dbus_message_iter_append_basic (&output_iter, DBUS_TYPE_INT32, &output_element)) {
39
 
                        dbus_message_iter_abandon_container (&iter, &output_iter);
40
 
                        dbus_message_unref (reply);
41
 
                        return -1;
42
 
                }
43
 
        }
44
 
 
45
 
        if (! dbus_message_iter_close_container (&iter, &output_iter)) {
46
 
                dbus_message_unref (reply);
47
 
                return -1;
48
 
        }
49
 
 
50
 
        /* Send the reply, appending it to the outgoing queue. */
51
 
        if (! dbus_connection_send (message->connection, reply, NULL)) {
52
 
                dbus_message_unref (reply);
53
 
                return -1;
54
 
        }
55
 
 
56
 
        dbus_message_unref (reply);
57
 
 
58
 
        return 0;
59
 
}