本文整理汇总了C++中dbus_error_has_name函数的典型用法代码示例。如果您正苦于以下问题:C++ dbus_error_has_name函数的具体用法?C++ dbus_error_has_name怎么用?C++ dbus_error_has_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbus_error_has_name函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: proxy_write_reply
static void proxy_write_reply(const DBusError *derr, void *user_data)
{
struct proxy_write_data *wdata = user_data;
int err;
/*
* Security requirements shall be handled by the core. If external
* applications returns an error, the reasons will be restricted to
* invalid argument or application specific errors.
*/
if (!dbus_error_is_set(derr)) {
err = 0;
goto done;
}
DBG("Write reply: %s", derr->message);
if (dbus_error_has_name(derr, DBUS_ERROR_NO_REPLY))
err = -ETIMEDOUT;
else if (dbus_error_has_name(derr, ERROR_INTERFACE ".InvalidArguments"))
err = -EINVAL;
else
err = -EPROTO;
done:
if (wdata && wdata->result_cb)
wdata->result_cb(err, wdata->user_data);
}
开发者ID:mjbshaw,项目名称:bluez,代码行数:29,代码来源:gatt-dbus.c
示例2: handle_reload_watch
static dbus_bool_t
handle_reload_watch (DBusWatch *watch,
unsigned int flags,
void *data)
{
DBusError error;
DBusString str;
_dbus_string_init (&str);
if ((reload_pipe[RELOAD_READ_END] > 0) &&
_dbus_read_socket (reload_pipe[RELOAD_READ_END], &str, 1) != 1)
{
_dbus_warn ("Couldn't read from reload pipe.\n");
close_reload_pipe ();
return TRUE;
}
_dbus_string_free (&str);
/* this can only fail if we don't understand the config file
* or OOM. Either way we should just stick with the currently
* loaded config.
*/
dbus_error_init (&error);
if (! bus_context_reload_config (context, &error))
{
_DBUS_ASSERT_ERROR_IS_SET (&error);
_dbus_assert (dbus_error_has_name (&error, DBUS_ERROR_FAILED) ||
dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY));
_dbus_warn ("Unable to reload configuration: %s\n",
error.message);
dbus_error_free (&error);
}
return TRUE;
}
开发者ID:psunkari,项目名称:spicebird,代码行数:33,代码来源:main.c
示例3: check_spawn_exit
static dbus_bool_t
check_spawn_exit (void *data)
{
char *argv[4] = { NULL, NULL, NULL, NULL };
DBusBabysitter *sitter;
DBusError error;
sitter = NULL;
dbus_error_init (&error);
/*** Test launching exit failure binary */
argv[0] = TEST_EXIT_BINARY;
if (_dbus_spawn_async_with_babysitter (&sitter, argv,
NULL, NULL,
&error))
{
#ifdef __SYMBIAN32__
if(sitter)
{
#endif
_dbus_babysitter_block_for_child_exit (sitter);
_dbus_babysitter_set_child_exit_error (sitter, &error);
#ifdef __SYMBIAN32__
}
#endif
/* no baby sitter support in Symbian */
}
if (sitter)
_dbus_babysitter_unref (sitter);
if (!dbus_error_is_set (&error))
{
_dbus_warn ("Did not get an error launching binary that exited with failure code\n");
return FALSE;
}
if (!(dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY) ||
dbus_error_has_name (&error, DBUS_ERROR_SPAWN_CHILD_EXITED)))
{
_dbus_warn ("Not expecting error when launching exiting executable: %s: %s\n",
error.name, error.message);
dbus_error_free (&error);
return FALSE;
}
dbus_error_free (&error);
return TRUE;
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:53,代码来源:dbus-spawn.c
示例4: check_spawn_and_kill
static dbus_bool_t
check_spawn_and_kill (void *data)
{
char *argv[4] = { NULL, NULL, NULL, NULL };
DBusBabysitter *sitter = NULL;
DBusError error = DBUS_ERROR_INIT;
DBusString argv0;
/*** Test launching sleeping binary then killing it */
argv[0] = get_test_exec ("test-sleep-forever", &argv0);
if (argv[0] == NULL)
{
/* OOM was simulated, never mind */
return TRUE;
}
if (_dbus_spawn_async_with_babysitter (&sitter, "spawn_and_kill", argv,
NULL, NULL, NULL,
&error))
{
_dbus_babysitter_kill_child (sitter);
_dbus_babysitter_block_for_child_exit (sitter);
_dbus_babysitter_set_child_exit_error (sitter, &error);
}
_dbus_string_free (&argv0);
if (sitter)
_dbus_babysitter_unref (sitter);
if (!dbus_error_is_set (&error))
{
_dbus_warn ("Did not get an error after killing spawned binary\n");
return FALSE;
}
if (!(dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY) ||
dbus_error_has_name (&error, DBUS_ERROR_SPAWN_CHILD_SIGNALED)))
{
_dbus_warn ("Not expecting error when killing executable: %s: %s\n",
error.name, error.message);
dbus_error_free (&error);
return FALSE;
}
dbus_error_free (&error);
return TRUE;
}
开发者ID:13824125580,项目名称:hello-world,代码行数:53,代码来源:dbus-spawn.c
示例5: simple_agent_reply
static void simple_agent_reply(DBusPendingCall *call, void *user_data)
{
struct agent_request *req = user_data;
struct agent *agent = req->agent;
DBusMessage *message;
DBusError err;
agent_cb cb = req->cb;
/* steal_reply will always return non-NULL since the callback
* is only called after a reply has been received */
message = dbus_pending_call_steal_reply(call);
dbus_error_init(&err);
if (dbus_set_error_from_message(&err, message)) {
error("Agent replied with an error: %s, %s",
err.name, err.message);
cb(agent, &err, req->user_data);
if (dbus_error_has_name(&err, DBUS_ERROR_NO_REPLY)) {
agent_cancel(agent);
dbus_message_unref(message);
dbus_error_free(&err);
return;
}
// +s LGBT_COMMON_TEMPORARY [email protected] 120829
if (dbus_error_has_name(&err, "org.bluez.Error.Canceled")) {
DBG("User cancel the pairing");
DBG("->device_set_temporary");
device_set_temporary(((struct authentication_req*) req->user_data)->device, TRUE);
}
// +e LGBT_COMMON_TEMPORARY
dbus_error_free(&err);
goto done;
}
dbus_error_init(&err);
if (!dbus_message_get_args(message, &err, DBUS_TYPE_INVALID)) {
error("Wrong reply signature: %s", err.message);
cb(agent, &err, req->user_data);
dbus_error_free(&err);
goto done;
}
cb(agent, NULL, req->user_data);
done:
dbus_message_unref(message);
agent->request = NULL;
agent_request_free(req, TRUE);
}
开发者ID:hakssung,项目名称:p920ics_package,代码行数:51,代码来源:agent.c
示例6: remove_connection_reply
static void remove_connection_reply(DBusPendingCall *call, void *user_data)
{
DBusMessage *reply;
DBusError error;
if (dbus_pending_call_get_completed(call) == FALSE)
return;
DBG("");
reply = dbus_pending_call_steal_reply(call);
dbus_error_init(&error);
if (dbus_set_error_from_message(&error, reply) == TRUE) {
/*
* If the returned error is NotFound, it means that we
* have actually removed the provider in vpnd already.
*/
if (dbus_error_has_name(&error, CONNMAN_ERROR_INTERFACE
".NotFound") == FALSE)
connman_error("%s", error.message);
dbus_error_free(&error);
}
dbus_message_unref(reply);
dbus_pending_call_unref(call);
}
开发者ID:manjurajv,项目名称:connman,代码行数:30,代码来源:vpn.c
示例7: bus_activation_helper_oom_test
/* returns true if good things happen, or if we get OOM */
static dbus_bool_t
bus_activation_helper_oom_test (void *data,
dbus_bool_t have_memory)
{
const char *service;
DBusError error;
dbus_bool_t retval;
service = (const char *) data;
retval = TRUE;
dbus_error_init (&error);
if (!run_launch_helper (service, &error))
{
_DBUS_ASSERT_ERROR_IS_SET (&error);
/* we failed, but a OOM is good */
if (!dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
{
_dbus_warn ("FAILED SELF TEST: Error: %s", error.message);
retval = FALSE;
}
dbus_error_free (&error);
}
else
{
/* we succeeded, yay! */
_DBUS_ASSERT_ERROR_IS_CLEAR (&error);
}
return retval;
}
开发者ID:halfline,项目名称:dbus,代码行数:32,代码来源:test-launch-helper.c
示例8: _dbus_read_uuid_file
/**
* Reads (and optionally writes) a uuid to a file. Initializes the uuid
* unless an error is returned.
*
* @param filename the name of the file
* @param uuid uuid to be initialized with the loaded uuid
* @param create_if_not_found #TRUE to create a new uuid and save it if the file doesn't exist
* @param error the error return
* @returns #FALSE if the error is set
*/
dbus_bool_t
_dbus_read_uuid_file (const DBusString *filename,
DBusGUID *uuid,
dbus_bool_t create_if_not_found,
DBusError *error)
{
DBusError read_error = DBUS_ERROR_INIT;
if (_dbus_read_uuid_file_without_creating (filename, uuid, &read_error))
return TRUE;
if (!create_if_not_found)
{
dbus_move_error (&read_error, error);
return FALSE;
}
/* If the file exists and contains junk, we want to keep that error
* message instead of overwriting it with a "file exists" error
* message when we try to write
*/
if (dbus_error_has_name (&read_error, DBUS_ERROR_INVALID_FILE_CONTENT))
{
dbus_move_error (&read_error, error);
return FALSE;
}
else
{
dbus_error_free (&read_error);
return _dbus_create_uuid_file_exclusively (filename, uuid, error);
}
}
开发者ID:psunkari,项目名称:spicebird,代码行数:42,代码来源:dbus-internals.c
示例9: gkr_operation_handle_errors
gboolean
gkr_operation_handle_errors (GkrOperation *op, DBusMessage *reply)
{
DBusError derr = DBUS_ERROR_INIT;
MateKeyringResult res;
gboolean was_keyring;
g_assert (op);
g_assert (reply);
was_keyring = op->was_keyring;
op->was_keyring = FALSE;
if (dbus_set_error_from_message (&derr, reply)) {
if (dbus_error_has_name (&derr, ERROR_NO_SUCH_OBJECT)) {
if (was_keyring)
res = MATE_KEYRING_RESULT_NO_SUCH_KEYRING;
else
res = MATE_KEYRING_RESULT_BAD_ARGUMENTS;
} else {
g_message ("secret service operation failed: %s", derr.message);
res = MATE_KEYRING_RESULT_IO_ERROR;
}
dbus_error_free (&derr);
gkr_operation_complete (op, res);
return TRUE;
}
return FALSE;
}
开发者ID:TheCoffeMaker,项目名称:Mate-Desktop-Environment,代码行数:31,代码来源:gkr-operation.c
示例10: thunar_dbus_client_terminate
/**
* thunar_dbus_client_terminate:
* @error : Return location for errors or %NULL.
*
* Tells a running Thunar instance, connected to the D-BUS
* session bus, to terminate immediately.
*
* Return value: %TRUE if any instance was terminated, else
* %FALSE and @error is set.
**/
gboolean
thunar_dbus_client_terminate (GError **error)
{
DBusConnection *connection;
DBusMessage *message;
DBusMessage *result;
DBusError derror;
_thunar_return_val_if_fail (error == NULL || *error == NULL, FALSE);
/* initialize the DBusError struct */
dbus_error_init (&derror);
/* try to connect to the session bus */
connection = dbus_bus_get (DBUS_BUS_SESSION, &derror);
if (G_UNLIKELY (connection == NULL))
{
dbus_set_g_error (error, &derror);
dbus_error_free (&derror);
return FALSE;
}
/* generate the LaunchFiles() method (disable activation!) */
message = dbus_message_new_method_call ("org.xfce.Thunar", "/org/xfce/FileManager", "org.xfce.Thunar", "Terminate");
dbus_message_set_auto_start (message, FALSE);
/* send the message and release our references on connection and message */
result = dbus_connection_send_with_reply_and_block (connection, message, -1, &derror);
dbus_message_unref (message);
/* check if no reply was received */
if (G_UNLIKELY (result == NULL))
{
/* check if there was nothing to terminate */
if (dbus_error_has_name (&derror, DBUS_ERROR_NAME_HAS_NO_OWNER))
{
dbus_error_free (&derror);
return TRUE;
}
/* Looks like there was a real error */
dbus_set_g_error (error, &derror);
dbus_error_free (&derror);
return FALSE;
}
/* but maybe we received an error */
if (dbus_message_get_type (result) == DBUS_MESSAGE_TYPE_ERROR)
{
dbus_set_error_from_message (&derror, result);
dbus_set_g_error (error, &derror);
dbus_message_unref (result);
dbus_error_free (&derror);
return FALSE;
}
/* let's asume that it worked */
dbus_message_unref (result);
return TRUE;
}
开发者ID:fibernet-us,项目名称:Thunar_sort_files_by_extension,代码行数:70,代码来源:thunar-dbus-client.c
示例11: check_spawn_and_kill
static dbus_bool_t
check_spawn_and_kill (void *data)
{
char *argv[4] = { NULL, NULL, NULL, NULL };
DBusBabysitter *sitter;
DBusError error;
sitter = NULL;
dbus_error_init (&error);
/*** Test launching sleeping binary then killing it */
argv[0] = TEST_SLEEP_FOREVER_BINARY;
if (_dbus_spawn_async_with_babysitter (&sitter, argv, NULL,
NULL, NULL,
&error))
{
_dbus_babysitter_kill_child (sitter);
_dbus_babysitter_block_for_child_exit (sitter);
_dbus_babysitter_set_child_exit_error (sitter, &error);
}
if (sitter)
_dbus_babysitter_unref (sitter);
if (!dbus_error_is_set (&error))
{
_dbus_warn ("Did not get an error after killing spawned binary\n");
return FALSE;
}
if (!(dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY) ||
dbus_error_has_name (&error, DBUS_ERROR_SPAWN_CHILD_EXITED)))
{
_dbus_warn ("Not expecting error when killing executable: %s: %s\n",
error.name, error.message);
dbus_error_free (&error);
return FALSE;
}
dbus_error_free (&error);
return TRUE;
}
开发者ID:psunkari,项目名称:spicebird,代码行数:47,代码来源:dbus-spawn-win.c
示例12: become_monitor
static dbus_bool_t
become_monitor (DBusConnection *connection,
int numFilters,
const char * const *filters)
{
DBusError error = DBUS_ERROR_INIT;
DBusMessage *m;
DBusMessage *r;
int i;
dbus_uint32_t zero = 0;
DBusMessageIter appender, array_appender;
m = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS, DBUS_INTERFACE_MONITORING, "BecomeMonitor");
if (m == NULL)
tool_oom ("becoming a monitor");
dbus_message_iter_init_append (m, &appender);
if (!dbus_message_iter_open_container (&appender, DBUS_TYPE_ARRAY, "s",
&array_appender))
tool_oom ("opening string array");
for (i = 0; i < numFilters; i++)
{
if (!dbus_message_iter_append_basic (&array_appender, DBUS_TYPE_STRING,
&filters[i]))
tool_oom ("adding filter to array");
}
if (!dbus_message_iter_close_container (&appender, &array_appender) ||
!dbus_message_iter_append_basic (&appender, DBUS_TYPE_UINT32, &zero))
tool_oom ("finishing arguments");
r = dbus_connection_send_with_reply_and_block (connection, m, -1, &error);
if (r != NULL)
{
dbus_message_unref (r);
}
else if (dbus_error_has_name (&error, DBUS_ERROR_UNKNOWN_INTERFACE))
{
fprintf (stderr, "dbus-monitor: unable to enable new-style monitoring, "
"your dbus-daemon is too old. Falling back to eavesdropping.\n");
dbus_error_free (&error);
}
else
{
fprintf (stderr, "dbus-monitor: unable to enable new-style monitoring: "
"%s: \"%s\". Falling back to eavesdropping.\n",
error.name, error.message);
dbus_error_free (&error);
}
dbus_message_unref (m);
return (r != NULL);
}
开发者ID:d-bus,项目名称:dbus,代码行数:59,代码来源:dbus-monitor.c
示例13: start_target
static void start_target(const char *target) {
DBusMessage *m = NULL, *reply = NULL;
DBusError error;
const char *mode = "replace", *basic_target = "basic.target";
DBusConnection *bus = NULL;
assert(target);
dbus_error_init(&error);
if (bus_connect(DBUS_BUS_SYSTEM, &bus, NULL, &error) < 0) {
log_error("Failed to get D-Bus connection: %s", bus_error_message(&error));
goto finish;
}
log_info("Running request %s/start/%s", target, mode);
if (!(m = dbus_message_new_method_call("org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StartUnitReplace"))) {
log_error("Could not allocate message.");
goto finish;
}
/* Start these units only if we can replace base.target with it */
if (!dbus_message_append_args(m,
DBUS_TYPE_STRING, &basic_target,
DBUS_TYPE_STRING, &target,
DBUS_TYPE_STRING, &mode,
DBUS_TYPE_INVALID)) {
log_error("Could not attach target and flag information to message.");
goto finish;
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
/* Don't print a warning if we aren't called during
* startup */
if (!dbus_error_has_name(&error, BUS_ERROR_NO_SUCH_JOB))
log_error("Failed to start unit: %s", bus_error_message(&error));
goto finish;
}
finish:
if (m)
dbus_message_unref(m);
if (reply)
dbus_message_unref(reply);
if (bus) {
dbus_connection_flush(bus);
dbus_connection_close(bus);
dbus_connection_unref(bus);
}
dbus_error_free(&error);
}
开发者ID:prodigeni,项目名称:systemd,代码行数:58,代码来源:fsck.c
示例14: check_spawn_nonexistent
static dbus_bool_t
check_spawn_nonexistent (void *data)
{
char *argv[4] = { NULL, NULL, NULL, NULL };
DBusBabysitter *sitter;
DBusError error;
sitter = NULL;
dbus_error_init (&error);
/*** Test launching nonexistent binary */
argv[0] = "/this/does/not/exist/32542sdgafgafdg";
if (_dbus_spawn_async_with_babysitter (&sitter, argv, NULL,
NULL, NULL,
&error))
{
_dbus_babysitter_block_for_child_exit (sitter);
_dbus_babysitter_set_child_exit_error (sitter, &error);
}
if (sitter)
_dbus_babysitter_unref (sitter);
if (!dbus_error_is_set (&error))
{
_dbus_warn ("Did not get an error launching nonexistent executable\n");
return FALSE;
}
if (!(dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY) ||
dbus_error_has_name (&error, DBUS_ERROR_SPAWN_EXEC_FAILED)))
{
_dbus_warn ("Not expecting error when launching nonexistent executable: %s: %s\n",
error.name, error.message);
dbus_error_free (&error);
return FALSE;
}
dbus_error_free (&error);
return TRUE;
}
开发者ID:psunkari,项目名称:spicebird,代码行数:44,代码来源:dbus-spawn-win.c
示例15: rd_dbus_get_name_owner
int rd_dbus_get_name_owner(
DBusConnection *connection,
const char *name,
char **name_owner,
DBusError *error) {
DBusMessage *msg, *reply;
int r;
*name_owner = NULL;
if (!(msg = dbus_message_new_method_call(DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, "GetNameOwner"))) {
r = -ENOMEM;
goto fail;
}
if (!dbus_message_append_args(msg, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID)) {
r = -ENOMEM;
goto fail;
}
reply = dbus_connection_send_with_reply_and_block(connection, msg, DBUS_TIMEOUT_USE_DEFAULT, error);
dbus_message_unref(msg);
msg = NULL;
if (reply) {
if (!dbus_message_get_args(reply, error, DBUS_TYPE_STRING, name_owner, DBUS_TYPE_INVALID)) {
dbus_message_unref(reply);
r = -EIO;
goto fail;
}
*name_owner = strdup(*name_owner);
dbus_message_unref(reply);
if (!*name_owner) {
r = -ENOMEM;
goto fail;
}
} else if (dbus_error_has_name(error, "org.freedesktop.DBus.Error.NameHasNoOwner"))
dbus_error_free(error);
else {
r = -EIO;
goto fail;
}
return 0;
fail:
if (msg)
dbus_message_unref(msg);
return r;
}
开发者ID:x42,项目名称:alsa_request_device,代码行数:55,代码来源:reserve.c
示例16: check_spawn_segfault
static dbus_bool_t
check_spawn_segfault (void *data)
{
char *argv[4] = { NULL, NULL, NULL, NULL };
DBusBabysitter *sitter = NULL;
DBusError error = DBUS_ERROR_INIT;
/*** Test launching segfault binary */
argv[0] = TEST_SEGFAULT_BINARY;
if (_dbus_spawn_async_with_babysitter (&sitter, argv,
NULL, NULL, NULL,
&error))
{
_dbus_babysitter_block_for_child_exit (sitter);
_dbus_babysitter_set_child_exit_error (sitter, &error);
}
if (sitter)
_dbus_babysitter_unref (sitter);
if (!dbus_error_is_set (&error))
{
_dbus_warn ("Did not get an error launching segfaulting binary\n");
return FALSE;
}
if (!(dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY) ||
dbus_error_has_name (&error, DBUS_ERROR_SPAWN_CHILD_SIGNALED)))
{
_dbus_warn ("Not expecting error when launching segfaulting executable: %s: %s\n",
error.name, error.message);
dbus_error_free (&error);
return FALSE;
}
dbus_error_free (&error);
return TRUE;
}
开发者ID:mirsal,项目名称:dbus,代码行数:40,代码来源:dbus-spawn.c
示例17: simple_agent_reply
static void simple_agent_reply(DBusPendingCall *call, void *user_data)
{
struct agent_request *req = user_data;
struct agent *agent = req->agent;
DBusMessage *message;
DBusError err;
agent_cb cb = req->cb;
/* steal_reply will always return non-NULL since the callback
* is only called after a reply has been received */
message = dbus_pending_call_steal_reply(call);
dbus_error_init(&err);
if (dbus_set_error_from_message(&err, message)) {
if ((g_str_equal(DBUS_ERROR_UNKNOWN_METHOD, err.name) ||
g_str_equal(DBUS_ERROR_NO_REPLY, err.name)) &&
request_fallback(req, simple_agent_reply) == 0) {
dbus_error_free(&err);
return;
}
error("Agent replied with an error: %s, %s",
err.name, err.message);
cb(agent, &err, req->user_data);
if (dbus_error_has_name(&err, DBUS_ERROR_NO_REPLY)) {
agent_cancel(agent);
dbus_message_unref(message);
dbus_error_free(&err);
return;
}
dbus_error_free(&err);
goto done;
}
dbus_error_init(&err);
if (!dbus_message_get_args(message, &err, DBUS_TYPE_INVALID)) {
error("Wrong reply signature: %s", err.message);
cb(agent, &err, req->user_data);
dbus_error_free(&err);
goto done;
}
cb(agent, NULL, req->user_data);
done:
dbus_message_unref(message);
agent->request = NULL;
agent_request_free(req, TRUE);
}
开发者ID:Mcjesus15,项目名称:Zio_Other,代码行数:52,代码来源:agent.c
示例18: do_load
static dbus_bool_t
do_load (const DBusString *full_path,
Validity validity,
dbus_bool_t oom_possible)
{
BusConfigParser *parser;
DBusError error;
dbus_error_init (&error);
parser = bus_config_load (full_path, TRUE, NULL, &error);
if (parser == NULL)
{
_DBUS_ASSERT_ERROR_IS_SET (&error);
if (oom_possible &&
dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
{
_dbus_verbose ("Failed to load valid file due to OOM\n");
dbus_error_free (&error);
return TRUE;
}
else if (validity == VALID)
{
_dbus_warn ("Failed to load valid file but still had memory: %s\n",
error.message);
dbus_error_free (&error);
return FALSE;
}
else
{
dbus_error_free (&error);
return TRUE;
}
}
else
{
_DBUS_ASSERT_ERROR_IS_CLEAR (&error);
bus_config_parser_unref (parser);
if (validity == INVALID)
{
_dbus_warn ("Accepted invalid file\n");
return FALSE;
}
return TRUE;
}
}
开发者ID:Jeanlst,项目名称:Onlive-Source-Backup,代码行数:51,代码来源:config-parser-trivial.c
示例19: auth_agent_req_reply
static void auth_agent_req_reply(DBusPendingCall *call, void *data)
{
struct auth_agent_req *req = data;
struct authorization_agent *agent = req->agent;
DBusMessage *reply = dbus_pending_call_steal_reply(call);
DBusMessage *message;
DBusError err;
debug("authorize reply");
dbus_error_init(&err);
if (dbus_set_error_from_message(&err, reply)) {
if (dbus_error_has_name(&err, DBUS_ERROR_NO_REPLY))
auth_agent_call_cancel(req);
error("Authorization agent replied with an error: %s, %s",
err.name, err.message);
dbus_error_free(&err);
goto reject;
}
dbus_error_init(&err);
if (!dbus_message_get_args(reply, &err, DBUS_TYPE_INVALID)) {
error("Wrong authorization agent reply signature: %s",
err.message);
dbus_error_free(&err);
goto reject;
}
message = dbus_message_new_method_return(req->msg);
if (!message)
goto reject;
send_message_and_unref(agent->conn, message);
debug("successfull reply was sent");
goto done;
reject:
error_rejected(agent->conn, req->msg);
done:
dbus_message_unref(reply);
agent->pending_requests = g_slist_remove(agent->pending_requests, req);
auth_agent_req_free(req);
debug("auth_agent_reply: returning");
}
开发者ID:tazjel,项目名称:QtSixA,代码行数:50,代码来源:dbus-security.c
示例20: simple_agent_reply
static void simple_agent_reply(DBusPendingCall *call, void *user_data)
{
struct agent_request *req = user_data;
struct agent *agent = req->agent;
DBusMessage *message;
DBusError err;
agent_cb cb = req->cb;
/* steal_reply will always return non-NULL since the callback
* is only called after a reply has been received */
message = dbus_pending_call_steal_reply(call);
/* Protect from the callback freeing the agent */
agent_ref(agent);
dbus_error_init(&err);
if (dbus_set_error_from_message(&err, message)) {
DBG("agent error reply: %s, %s", err.name, err.message);
cb(agent, &err, req->user_data);
if (dbus_error_has_name(&err, DBUS_ERROR_NO_REPLY)) {
error("Timed out waiting for reply from agent");
agent_cancel(agent);
dbus_message_unref(message);
dbus_error_free(&err);
agent_unref(agent);
return;
}
dbus_error_free(&err);
goto done;
}
if (!dbus_message_get_args(message, &err, DBUS_TYPE_INVALID)) {
error("Wrong reply signature: %s", err.message);
cb(agent, &err, req->user_data);
dbus_error_free(&err);
goto done;
}
cb(agent, NULL, req->user_data);
done:
dbus_message_unref(message);
agent->request = NULL;
agent_request_free(req, TRUE);
agent_unref(agent);
}
开发者ID:ghent360,项目名称:bluez,代码行数:49,代码来源:agent.c
注:本文中的dbus_error_has_name函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论