chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
systemctl: avoid wrapping of headers/footers
[elogind.git]
/
src
/
systemctl.c
diff --git
a/src/systemctl.c
b/src/systemctl.c
index 0c33abb3077da61257c195ab142db4d0e9215109..de41db79e2eb4e5bcd9bef7733fae1bae2476f04 100644
(file)
--- a/
src/systemctl.c
+++ b/
src/systemctl.c
@@
-130,8
+130,7
@@
static const char *ansi_highlight_green(bool b) {
return b ? ANSI_HIGHLIGHT_GREEN_ON : ANSI_HIGHLIGHT_OFF;
}
return b ? ANSI_HIGHLIGHT_GREEN_ON : ANSI_HIGHLIGHT_OFF;
}
-static bool error_is_no_service(DBusError *error) {
-
+static bool error_is_no_service(const DBusError *error) {
assert(error);
if (!dbus_error_is_set(error))
assert(error);
if (!dbus_error_is_set(error))
@@
-249,7
+248,7
@@
static int list_units(DBusConnection *bus, char **args, unsigned n) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-313,8
+312,12
@@
static int list_units(DBusConnection *bus, char **args, unsigned n) {
qsort(unit_infos, c, sizeof(struct unit_info), compare_unit_info);
qsort(unit_infos, c, sizeof(struct unit_info), compare_unit_info);
- if (isatty(STDOUT_FILENO))
- printf("%-45s %-6s %-12s %-12s %-15s %s\n", "UNIT", "LOAD", "ACTIVE", "SUB", "JOB", "DESCRIPTION");
+ if (isatty(STDOUT_FILENO)) {
+ if (columns() >= 80+12 || arg_full)
+ printf("%-25s %-6s %-12s %-18s %-15s %s\n", "UNIT", "LOAD", "ACTIVE", "SUB", "JOB", "DESCRIPTION");
+ else
+ printf("%-25s %-6s %-12s %-18s %-15s\n", "UNIT", "LOAD", "ACTIVE", "SUB", "JOB");
+ }
for (k = 0; k < c; k++) {
const char *dot;
for (k = 0; k < c; k++) {
const char *dot;
@@
-325,30
+328,47
@@
static int list_units(DBusConnection *bus, char **args, unsigned n) {
(arg_all || !(streq(u->active_state, "inactive") || u->following[0]) || u->job_id > 0)) {
char *e;
int a = 0, b = 0;
(arg_all || !(streq(u->active_state, "inactive") || u->following[0]) || u->job_id > 0)) {
char *e;
int a = 0, b = 0;
- const char *on, *off;
+ const char *on_loaded, *off_loaded;
+ const char *on_active, *off_active;
+
+ if (!streq(u->load_state, "loaded")) {
+ on_loaded = ansi_highlight(true);
+ off_loaded = ansi_highlight(false);
+ } else
+ on_loaded = off_loaded = "";
- if (streq(u->active_state, "
maintenance
")) {
- on = ansi_highlight(true);
- off = ansi_highlight(false);
+ if (streq(u->active_state, "
failed
")) {
+ on
_active
= ansi_highlight(true);
+ off
_active
= ansi_highlight(false);
} else
} else
- on = off = "";
+ on_active = off_active = "";
+
+ e = arg_full ? NULL : ellipsize(u->id, 25, 33);
+
+ printf("%-25s %s%-6s%s %s%-12s %-18s%s%n",
+ e ? e : u->id,
+ on_loaded, u->load_state, off_loaded,
+ on_active, u->active_state, u->sub_state, off_active,
+ &a);
- e = arg_full ? NULL : ellipsize(u->id, 45, 33);
- printf("%-45s %-6s %s%-12s %-12s%s%n", e ? e : u->id, u->load_state, on, u->active_state, u->sub_state, off, &a);
free(e);
free(e);
- a -= strlen(on) + strlen(off);
+ a -= strlen(on_loaded) + strlen(off_loaded);
+ a -= strlen(on_active) + strlen(off_active);
if (u->job_id != 0)
if (u->job_id != 0)
- printf("
=> %-12
s%n", u->job_type, &b);
+ printf("
%-15
s%n", u->job_type, &b);
else
b = 1 + 15;
else
b = 1 + 15;
- if (a + b +
2
< columns()) {
+ if (a + b +
1
< columns()) {
if (u->job_id == 0)
printf(" ");
if (u->job_id == 0)
printf(" ");
- printf(" %.*s", columns() - a - b - 2, u->description);
+ if (arg_full)
+ printf(" %s", u->description);
+ else
+ printf(" %.*s", columns() - a - b - 1, u->description);
}
fputs("\n", stdout);
}
fputs("\n", stdout);
@@
-473,7
+493,7
@@
static int dot_one(DBusConnection *bus, const char *name, const char *path) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-556,7
+576,7
@@
static int dot(DBusConnection *bus, char **args, unsigned n) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-649,7
+669,7
@@
static int list_jobs(DBusConnection *bus, char **args, unsigned n) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-664,7
+684,8
@@
static int list_jobs(DBusConnection *bus, char **args, unsigned n) {
dbus_message_iter_recurse(&iter, &sub);
dbus_message_iter_recurse(&iter, &sub);
- printf("%4s %-45s %-17s %-7s\n", "JOB", "UNIT", "TYPE", "STATE");
+ if (isatty(STDOUT_FILENO))
+ printf("%4s %-25s %-15s %-7s\n", "JOB", "UNIT", "TYPE", "STATE");
while (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_INVALID) {
const char *name, *type, *state, *job_path, *unit_path;
while (dbus_message_iter_get_arg_type(&sub) != DBUS_TYPE_INVALID) {
const char *name, *type, *state, *job_path, *unit_path;
@@
-690,8
+711,8
@@
static int list_jobs(DBusConnection *bus, char **args, unsigned n) {
goto finish;
}
goto finish;
}
- e = arg_full ? NULL : ellipsize(name,
4
5, 33);
- printf("%4u %-
45s %-17
s %-7s\n", id, e ? e : name, type, state);
+ e = arg_full ? NULL : ellipsize(name,
2
5, 33);
+ printf("%4u %-
25s %-15
s %-7s\n", id, e ? e : name, type, state);
free(e);
k++;
free(e);
k++;
@@
-699,7
+720,9
@@
static int list_jobs(DBusConnection *bus, char **args, unsigned n) {
dbus_message_iter_next(&sub);
}
dbus_message_iter_next(&sub);
}
- printf("\n%u jobs listed.\n", k);
+ if (isatty(STDOUT_FILENO))
+ printf("\n%u jobs listed.\n", k);
+
r = 0;
finish:
r = 0;
finish:
@@
-746,7
+769,7
@@
static int load_unit(DBusConnection *bus, char **args, unsigned n) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-814,7
+837,7
@@
static int cancel_job(DBusConnection *bus, char **args, unsigned n) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-822,7
+845,7
@@
static int cancel_job(DBusConnection *bus, char **args, unsigned n) {
if (!dbus_message_get_args(reply, &error,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID)) {
if (!dbus_message_get_args(reply, &error,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID)) {
- log_error("Failed to parse reply: %s",
error.message
);
+ log_error("Failed to parse reply: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-840,7
+863,7
@@
static int cancel_job(DBusConnection *bus, char **args, unsigned n) {
dbus_message_unref(reply);
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
dbus_message_unref(reply);
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-969,7
+992,7
@@
static DBusHandlerResult wait_filter(DBusConnection *connection, DBusMessage *me
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_BOOLEAN, &success,
DBUS_TYPE_INVALID))
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_BOOLEAN, &success,
DBUS_TYPE_INVALID))
- log_error("Failed to parse message: %s",
error.message
);
+ log_error("Failed to parse message: %s",
bus_error_message(&error)
);
else {
char *p;
else {
char *p;
@@
-1003,7
+1026,7
@@
static int enable_wait_for_jobs(DBusConnection *bus) {
&error);
if (dbus_error_is_set(&error)) {
&error);
if (dbus_error_is_set(&error)) {
- log_error("Failed to add match: %s",
error.message
);
+ log_error("Failed to add match: %s",
bus_error_message(&error)
);
dbus_error_free(&error);
return -EIO;
}
dbus_error_free(&error);
return -EIO;
}
@@
-1092,7
+1115,7
@@
static int start_unit_one(
goto finish;
}
goto finish;
}
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-1100,7
+1123,7
@@
static int start_unit_one(
if (!dbus_message_get_args(reply, &error,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID)) {
if (!dbus_message_get_args(reply, &error,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID)) {
- log_error("Failed to parse reply: %s",
error.message
);
+ log_error("Failed to parse reply: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-1312,7
+1335,7
@@
static int check_unit(DBusConnection *bus, char **args, unsigned n) {
if (!dbus_message_get_args(reply, &error,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID)) {
if (!dbus_message_get_args(reply, &error,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID)) {
- log_error("Failed to parse reply: %s",
error.message
);
+ log_error("Failed to parse reply: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-1339,7
+1362,7
@@
static int check_unit(DBusConnection *bus, char **args, unsigned n) {
dbus_message_unref(reply);
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
dbus_message_unref(reply);
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-1557,7
+1580,7
@@
static void print_status_info(UnitStatusInfo *i) {
ss = streq_ptr(i->active_state, i->sub_state) ? NULL : i->sub_state;
ss = streq_ptr(i->active_state, i->sub_state) ? NULL : i->sub_state;
- if (streq_ptr(i->active_state, "
maintenance
")) {
+ if (streq_ptr(i->active_state, "
failed
")) {
on = ansi_highlight(true);
off = ansi_highlight(false);
} else if (streq_ptr(i->active_state, "active") || streq_ptr(i->active_state, "reloading")) {
on = ansi_highlight(true);
off = ansi_highlight(false);
} else if (streq_ptr(i->active_state, "active") || streq_ptr(i->active_state, "reloading")) {
@@
-1581,7
+1604,7
@@
static void print_status_info(UnitStatusInfo *i) {
timestamp = (streq_ptr(i->active_state, "active") ||
streq_ptr(i->active_state, "reloading")) ? i->active_enter_timestamp :
(streq_ptr(i->active_state, "inactive") ||
timestamp = (streq_ptr(i->active_state, "active") ||
streq_ptr(i->active_state, "reloading")) ? i->active_enter_timestamp :
(streq_ptr(i->active_state, "inactive") ||
- streq_ptr(i->active_state, "
maintenance"))
? i->inactive_enter_timestamp :
+ streq_ptr(i->active_state, "
failed"))
? i->inactive_enter_timestamp :
streq_ptr(i->active_state, "activating") ? i->inactive_exit_timestamp :
i->active_exit_timestamp;
streq_ptr(i->active_state, "activating") ? i->inactive_exit_timestamp :
i->active_exit_timestamp;
@@
-1613,7
+1636,7
@@
static void print_status_info(UnitStatusInfo *i) {
continue;
t = strv_join(p->argv, " ");
continue;
t = strv_join(p->argv, " ");
- printf("\t
Exited
: %u (%s, code=%s, ", p->pid, strna(t), sigchld_code_to_string(p->code));
+ printf("\t
Process
: %u (%s, code=%s, ", p->pid, strna(t), sigchld_code_to_string(p->code));
free(t);
if (p->code == CLD_EXITED) {
free(t);
if (p->code == CLD_EXITED) {
@@
-1642,7
+1665,7
@@
static void print_status_info(UnitStatusInfo *i) {
printf("\t");
if (i->main_pid > 0) {
printf("\t");
if (i->main_pid > 0) {
- printf("
Main
: %u", (unsigned) i->main_pid);
+ printf("
Main PID
: %u", (unsigned) i->main_pid);
if (i->running) {
char *t = NULL;
if (i->running) {
char *t = NULL;
@@
-2129,7
+2152,7
@@
static int show_one(DBusConnection *bus, const char *path, bool show_properties,
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2272,7
+2295,7
@@
static int show(DBusConnection *bus, char **args, unsigned n) {
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
if (!dbus_error_has_name(&error, DBUS_ERROR_ACCESS_DENIED)) {
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
if (!dbus_error_has_name(&error, DBUS_ERROR_ACCESS_DENIED)) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2299,7
+2322,7
@@
static int show(DBusConnection *bus, char **args, unsigned n) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2328,7
+2351,7
@@
static int show(DBusConnection *bus, char **args, unsigned n) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2355,7
+2378,7
@@
static int show(DBusConnection *bus, char **args, unsigned n) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2364,7
+2387,7
@@
static int show(DBusConnection *bus, char **args, unsigned n) {
if (!dbus_message_get_args(reply, &error,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID)) {
if (!dbus_message_get_args(reply, &error,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID)) {
- log_error("Failed to parse reply: %s",
error.message
);
+ log_error("Failed to parse reply: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2417,7
+2440,7
@@
static DBusHandlerResult monitor_filter(DBusConnection *connection, DBusMessage
DBUS_TYPE_STRING, &id,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID))
DBUS_TYPE_STRING, &id,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID))
- log_error("Failed to parse message: %s",
error.message
);
+ log_error("Failed to parse message: %s",
bus_error_message(&error)
);
else if (streq(dbus_message_get_member(message), "UnitNew"))
printf("Unit %s added.\n", id);
else
else if (streq(dbus_message_get_member(message), "UnitNew"))
printf("Unit %s added.\n", id);
else
@@
-2432,7
+2455,7
@@
static DBusHandlerResult monitor_filter(DBusConnection *connection, DBusMessage
DBUS_TYPE_UINT32, &id,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID))
DBUS_TYPE_UINT32, &id,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID))
- log_error("Failed to parse message: %s",
error.message
);
+ log_error("Failed to parse message: %s",
bus_error_message(&error)
);
else if (streq(dbus_message_get_member(message), "JobNew"))
printf("Job %u added.\n", id);
else
else if (streq(dbus_message_get_member(message), "JobNew"))
printf("Job %u added.\n", id);
else
@@
-2449,7
+2472,7
@@
static DBusHandlerResult monitor_filter(DBusConnection *connection, DBusMessage
if (!dbus_message_get_args(message, &error,
DBUS_TYPE_STRING, &interface,
DBUS_TYPE_INVALID)) {
if (!dbus_message_get_args(message, &error,
DBUS_TYPE_STRING, &interface,
DBUS_TYPE_INVALID)) {
- log_error("Failed to parse message: %s",
error.message
);
+ log_error("Failed to parse message: %s",
bus_error_message(&error)
);
goto finish;
}
goto finish;
}
@@
-2475,7
+2498,7
@@
static DBusHandlerResult monitor_filter(DBusConnection *connection, DBusMessage
}
if (!(reply = dbus_connection_send_with_reply_and_block(connection, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(connection, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
goto finish;
}
goto finish;
}
@@
-2547,7
+2570,7
@@
static int monitor(DBusConnection *bus, char **args, unsigned n) {
&error);
if (dbus_error_is_set(&error)) {
&error);
if (dbus_error_is_set(&error)) {
- log_error("Failed to add match: %s",
error.message
);
+ log_error("Failed to add match: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2560,7
+2583,7
@@
static int monitor(DBusConnection *bus, char **args, unsigned n) {
&error);
if (dbus_error_is_set(&error)) {
&error);
if (dbus_error_is_set(&error)) {
- log_error("Failed to add match: %s",
error.message
);
+ log_error("Failed to add match: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2583,7
+2606,7
@@
static int monitor(DBusConnection *bus, char **args, unsigned n) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2626,7
+2649,7
@@
static int dump(DBusConnection *bus, char **args, unsigned n) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2634,7
+2657,7
@@
static int dump(DBusConnection *bus, char **args, unsigned n) {
if (!dbus_message_get_args(reply, &error,
DBUS_TYPE_STRING, &text,
DBUS_TYPE_INVALID)) {
if (!dbus_message_get_args(reply, &error,
DBUS_TYPE_STRING, &text,
DBUS_TYPE_INVALID)) {
- log_error("Failed to parse reply: %s",
error.message
);
+ log_error("Failed to parse reply: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2690,7
+2713,7
@@
static int snapshot(DBusConnection *bus, char **args, unsigned n) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2698,7
+2721,7
@@
static int snapshot(DBusConnection *bus, char **args, unsigned n) {
if (!dbus_message_get_args(reply, &error,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID)) {
if (!dbus_message_get_args(reply, &error,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID)) {
- log_error("Failed to parse reply: %s",
error.message
);
+ log_error("Failed to parse reply: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2724,7
+2747,7
@@
static int snapshot(DBusConnection *bus, char **args, unsigned n) {
dbus_message_unref(reply);
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
dbus_message_unref(reply);
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2795,7
+2818,7
@@
static int delete_snapshot(DBusConnection *bus, char **args, unsigned n) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2803,7
+2826,7
@@
static int delete_snapshot(DBusConnection *bus, char **args, unsigned n) {
if (!dbus_message_get_args(reply, &error,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID)) {
if (!dbus_message_get_args(reply, &error,
DBUS_TYPE_OBJECT_PATH, &path,
DBUS_TYPE_INVALID)) {
- log_error("Failed to parse reply: %s",
error.message
);
+ log_error("Failed to parse reply: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2821,7
+2844,7
@@
static int delete_snapshot(DBusConnection *bus, char **args, unsigned n) {
dbus_message_unref(reply);
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
dbus_message_unref(reply);
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2864,7
+2887,7
@@
static int daemon_reload(DBusConnection *bus, char **args, unsigned n) {
streq(args[0], "clear-jobs") ||
streq(args[0], "cancel") ? "ClearJobs" :
streq(args[0], "daemon-reexec") ? "Reexecute" :
streq(args[0], "clear-jobs") ||
streq(args[0], "cancel") ? "ClearJobs" :
streq(args[0], "daemon-reexec") ? "Reexecute" :
- streq(args[0], "reset-
maintenance") ? "ResetMaintenance
" :
+ streq(args[0], "reset-
failed") ? "ResetFailed
" :
streq(args[0], "daemon-exit") ? "Exit" :
"Reload";
}
streq(args[0], "daemon-exit") ? "Exit" :
"Reload";
}
@@
-2887,7
+2910,7
@@
static int daemon_reload(DBusConnection *bus, char **args, unsigned n) {
goto finish;
}
goto finish;
}
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2906,7
+2929,7
@@
finish:
return r;
}
return r;
}
-static int reset_
maintenance
(DBusConnection *bus, char **args, unsigned n) {
+static int reset_
failed
(DBusConnection *bus, char **args, unsigned n) {
DBusMessage *m = NULL, *reply = NULL;
unsigned i;
int r;
DBusMessage *m = NULL, *reply = NULL;
unsigned i;
int r;
@@
-2924,7
+2947,7
@@
static int reset_maintenance(DBusConnection *bus, char **args, unsigned n) {
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
- "Reset
Maintenance
Unit"))) {
+ "Reset
Failed
Unit"))) {
log_error("Could not allocate message.");
r = -ENOMEM;
goto finish;
log_error("Could not allocate message.");
r = -ENOMEM;
goto finish;
@@
-2939,7
+2962,7
@@
static int reset_maintenance(DBusConnection *bus, char **args, unsigned n) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-2993,7
+3016,7
@@
static int show_enviroment(DBusConnection *bus, char **args, unsigned n) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-3091,7
+3114,7
@@
static int set_environment(DBusConnection *bus, char **args, unsigned n) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
}
if (!(reply = dbus_connection_send_with_reply_and_block(bus, m, -1, &error))) {
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-3834,8
+3857,8
@@
static int systemctl_help(void) {
" status [NAME...|PID...] Show runtime status of one or more units\n"
" show [NAME...|JOB...] Show properties of one or more\n"
" units/jobs or the manager\n"
" status [NAME...|PID...] Show runtime status of one or more units\n"
" show [NAME...|JOB...] Show properties of one or more\n"
" units/jobs or the manager\n"
- " reset-
maintenance [NAME...] Reset maintenance state for all, one,
\n"
- "
or more
units\n"
+ " reset-
failed [NAME...] Reset failed state for all, one, or more
\n"
+ " units\n"
" enable [NAME...] Enable one or more unit files\n"
" disable [NAME...] Disable one or more unit files\n"
" is-enabled [NAME...] Check whether unit files are enabled\n"
" enable [NAME...] Enable one or more unit files\n"
" disable [NAME...] Disable one or more unit files\n"
" is-enabled [NAME...] Check whether unit files are enabled\n"
@@
-4526,7
+4549,7
@@
static int talk_upstart(void) {
goto finish;
}
goto finish;
}
- log_error("Failed to connect to Upstart bus: %s",
error.message
);
+ log_error("Failed to connect to Upstart bus: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-4570,7
+4593,7
@@
static int talk_upstart(void) {
goto finish;
}
goto finish;
}
- log_error("Failed to issue method call: %s",
error.message
);
+ log_error("Failed to issue method call: %s",
bus_error_message(&error)
);
r = -EIO;
goto finish;
}
r = -EIO;
goto finish;
}
@@
-4677,7
+4700,7
@@
static int systemctl_main(DBusConnection *bus, int argc, char *argv[], DBusError
{ "default", EQUAL, 1, start_special },
{ "rescue", EQUAL, 1, start_special },
{ "emergency", EQUAL, 1, start_special },
{ "default", EQUAL, 1, start_special },
{ "rescue", EQUAL, 1, start_special },
{ "emergency", EQUAL, 1, start_special },
- { "reset-
maintenance", MORE, 1, reset_maintenance
},
+ { "reset-
failed", MORE, 1, reset_failed
},
{ "enable", MORE, 2, enable_unit },
{ "disable", MORE, 2, enable_unit },
{ "is-enabled", MORE, 2, enable_unit }
{ "enable", MORE, 2, enable_unit },
{ "disable", MORE, 2, enable_unit },
{ "is-enabled", MORE, 2, enable_unit }
@@
-4862,7
+4885,7
@@
static int halt_main(DBusConnection *bus) {
int r;
if (geteuid() != 0) {
int r;
if (geteuid() != 0) {
- log_error("Must
to
be root.");
+ log_error("Must be root.");
return -EPERM;
}
return -EPERM;
}