blob: 8f63d0442076ac4ad534853dc1db664cccdd7073 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dbus/dbus.h>
#include <dbus/dbus-connection-internal.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
static void
die (const char *message)
{
fprintf (stderr, "*** test-ids: %s", message);
exit (1);
}
int
main (int argc,
char **argv)
{
DBusError error;
DBusConnection *connection;
char *id;
char *server_id;
dbus_error_init (&error);
connection = dbus_bus_get (DBUS_BUS_SESSION, &error);
if (connection == NULL)
{
fprintf (stderr, "*** Failed to open connection to system bus: %s\n",
error.message);
dbus_error_free (&error);
return 1;
}
server_id = dbus_connection_get_server_id (connection);
if (server_id == NULL)
die ("No bus server ID retrieved\n");
/* printf("'%s'\n", server_id); */
if (strlen (server_id) != 32)
die ("Bus server id should have length 32\n");
dbus_free (server_id);
id = dbus_bus_get_id (connection, NULL);
if (id == NULL)
die ("No bus ID retrieved\n");
/* printf("'%s'\n", id); */
if (strlen (id) != 32)
die ("Bus ID should have length 32\n");
dbus_free (id);
_dbus_verbose ("*** Test IDs exiting\n");
return 0;
}
|