chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dbus: introduce _cleanup_dbus_error_free_
[elogind.git]
/
src
/
core
/
dbus-manager.c
diff --git
a/src/core/dbus-manager.c
b/src/core/dbus-manager.c
index 8a6449493a709544741e3261fcad964bbf7fd065..262e5ffef47d23642da5ff00f54eff572818c01a 100644
(file)
--- a/
src/core/dbus-manager.c
+++ b/
src/core/dbus-manager.c
@@
-352,17
+352,21
@@
static int bus_manager_set_log_target(DBusMessageIter *i, const char *property,
}
static int bus_manager_append_log_level(DBusMessageIter *i, const char *property, void *data) {
}
static int bus_manager_append_log_level(DBusMessageIter *i, const char *property, void *data) {
- const char *t;
+ char *t;
+ int r;
assert(i);
assert(property);
assert(i);
assert(property);
- t = log_level_to_string(log_get_max_level());
+ r = log_level_to_string_alloc(log_get_max_level(), &t);
+ if (r < 0)
+ return r;
if (!dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &t))
if (!dbus_message_iter_append_basic(i, DBUS_TYPE_STRING, &t))
- r
eturn
-ENOMEM;
+ r
=
-ENOMEM;
- return 0;
+ free(t);
+ return r;
}
static int bus_manager_set_log_level(DBusMessageIter *i, const char *property, void *data) {
}
static int bus_manager_set_log_level(DBusMessageIter *i, const char *property, void *data) {
@@
-641,7
+645,7
@@
static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
goto oom;
path = unit_dbus_path(u);
goto oom;
path = unit_dbus_path(u);
- if (!
reply
)
+ if (!
path
)
goto oom;
if (!dbus_message_append_args(
goto oom;
if (!dbus_message_append_args(
@@
-736,7
+740,8
@@
static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
if (r < 0)
return bus_send_error_reply(connection, message, &error, r);
if (r < 0)
return bus_send_error_reply(connection, message, &error, r);
- if (!(reply = dbus_message_new_method_return(message)))
+ reply = dbus_message_new_method_return(message);
+ if (!reply)
goto oom;
} else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "GetJob")) {
goto oom;
} else if (dbus_message_is_method_call(message, "org.freedesktop.systemd1.Manager", "GetJob")) {
@@
-1354,7
+1359,8
@@
static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
if (!e)
goto oom;
if (!e)
goto oom;
- if (!(reply = dbus_message_new_method_return(message))) {
+ reply = dbus_message_new_method_return(message);
+ if (!reply) {
strv_free(e);
goto oom;
}
strv_free(e);
goto oom;
}
@@
-1406,7
+1412,8
@@
static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
if (!f)
goto oom;
if (!f)
goto oom;
- if (!(reply = dbus_message_new_method_return(message))) {
+ reply = dbus_message_new_method_return(message);
+ if (!reply) {
strv_free(f);
goto oom;
}
strv_free(f);
goto oom;
}
@@
-1432,7
+1439,6
@@
static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
r = unit_file_get_list(m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, NULL, h);
if (r < 0) {
unit_file_list_free(h);
r = unit_file_get_list(m->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER, NULL, h);
if (r < 0) {
unit_file_list_free(h);
- dbus_message_unref(reply);
return bus_send_error_reply(connection, message, NULL, r);
}
return bus_send_error_reply(connection, message, NULL, r);
}