chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
systemd-python: refuse path and flags together in __init__
[elogind.git]
/
src
/
systemctl
/
systemctl.c
diff --git
a/src/systemctl/systemctl.c
b/src/systemctl/systemctl.c
index 418a80b6f0375e064ca5cd738e9291901f47a5a8..72e9c5539b13d53b75719f954f17ee1c2d9cef14 100644
(file)
--- a/
src/systemctl/systemctl.c
+++ b/
src/systemctl/systemctl.c
@@
-2084,7
+2084,11
@@
static int get_cgroup_attr(DBusConnection *bus, char **args) {
if (r < 0)
return r;
if (r < 0)
return r;
- dbus_message_iter_init(reply, &iter);
+ if (!dbus_message_iter_init(reply, &iter)) {
+ log_error("Failed to initialize iterator.");
+ return -EIO;
+ }
+
r = bus_parse_strv_iter(&iter, &list);
if (r < 0) {
log_error("Failed to parse value list.");
r = bus_parse_strv_iter(&iter, &list);
if (r < 0) {
log_error("Failed to parse value list.");
@@
-3951,7
+3955,7
@@
static int enable_unit(DBusConnection *bus, char **args) {
}
/* Try to reload if enabeld */
}
/* Try to reload if enabeld */
- if (!arg_no_reload
&& running_in_chroot() <= 0
)
+ if (!arg_no_reload)
r = daemon_reload(bus, args);
}
r = daemon_reload(bus, args);
}
@@
-3978,6
+3982,7
@@
static int unit_is_enabled(DBusConnection *bus, char **args) {
DBusMessage _cleanup_dbus_message_unref_ *reply = NULL;
bool enabled;
char **name;
DBusMessage _cleanup_dbus_message_unref_ *reply = NULL;
bool enabled;
char **name;
+ char *n;
dbus_error_init(&error);
dbus_error_init(&error);
@@
-3992,7
+3997,14
@@
static int unit_is_enabled(DBusConnection *bus, char **args) {
STRV_FOREACH(name, args+1) {
UnitFileState state;
STRV_FOREACH(name, args+1) {
UnitFileState state;
- state = unit_file_get_state(arg_scope, arg_root, *name);
+ n = unit_name_mangle(*name);
+ if (!n)
+ return log_oom();
+
+ state = unit_file_get_state(arg_scope, arg_root, n);
+
+ free(n);
+
if (state < 0)
return state;
if (state < 0)
return state;
@@
-4009,6
+4021,10
@@
static int unit_is_enabled(DBusConnection *bus, char **args) {
STRV_FOREACH(name, args+1) {
const char *s;
STRV_FOREACH(name, args+1) {
const char *s;
+ n = unit_name_mangle(*name);
+ if (!n)
+ return log_oom();
+
r = bus_method_call_with_reply (
bus,
"org.freedesktop.systemd1",
r = bus_method_call_with_reply (
bus,
"org.freedesktop.systemd1",
@@
-4017,8
+4033,11
@@
static int unit_is_enabled(DBusConnection *bus, char **args) {
"GetUnitFileState",
&reply,
NULL,
"GetUnitFileState",
&reply,
NULL,
- DBUS_TYPE_STRING,
name
,
+ DBUS_TYPE_STRING,
&n
,
DBUS_TYPE_INVALID);
DBUS_TYPE_INVALID);
+
+ free(n);
+
if (r)
return r;
if (r)
return r;