chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
service: properly handle if the main process is down and we wait for the cgroup to...
[elogind.git]
/
src
/
initctl.c
diff --git
a/src/initctl.c
b/src/initctl.c
index e1ab3f7e49ff74afb7f68276f557fbe6ead517a6..10db2dda188e95eae7d6ae814a0ea8c35fb95381 100644
(file)
--- a/
src/initctl.c
+++ b/
src/initctl.c
@@
-119,12
+119,12
@@
static void change_runlevel(Server *s, int runlevel) {
DBUS_TYPE_STRING, &target,
DBUS_TYPE_STRING, &replace,
DBUS_TYPE_INVALID)) {
DBUS_TYPE_STRING, &target,
DBUS_TYPE_STRING, &replace,
DBUS_TYPE_INVALID)) {
- log_error("Could not attach target and flag information to
signal
message.");
+ log_error("Could not attach target and flag information to message.");
goto finish;
}
if (!(reply = dbus_connection_send_with_reply_and_block(s->bus, m, -1, &error))) {
goto finish;
}
if (!(reply = dbus_connection_send_with_reply_and_block(s->bus, m, -1, &error))) {
- log_error("Failed to start unit: %s",
error.message
);
+ log_error("Failed to start unit: %s",
bus_error_message(&error)
);
goto finish;
}
goto finish;
}
@@
-232,8
+232,9
@@
static void server_done(Server *s) {
close_nointr_nofail(s->epoll_fd);
if (s->bus) {
close_nointr_nofail(s->epoll_fd);
if (s->bus) {
- dbus_connection_close(s->bus);
- dbus_connection_unref(s->bus);
+ dbus_connection_flush(s->bus);
+ dbus_connection_close(s->bus);
+ dbus_connection_unref(s->bus);
}
}
}
}
@@
-298,7
+299,7
@@
static int server_init(Server *s, unsigned n_sockets) {
}
if (bus_connect(DBUS_BUS_SYSTEM, &s->bus, NULL, &error) < 0) {
}
if (bus_connect(DBUS_BUS_SYSTEM, &s->bus, NULL, &error) < 0) {
- log_error("Failed to get D-Bus connection: %s",
error.message
);
+ log_error("Failed to get D-Bus connection: %s",
bus_error_message(&error)
);
goto fail;
}
goto fail;
}
@@
-335,33
+336,34
@@
static int process_event(Server *s, struct epoll_event *ev) {
int main(int argc, char *argv[]) {
Server server;
int main(int argc, char *argv[]) {
Server server;
- int r =
3
, n;
+ int r =
EXIT_FAILURE
, n;
if (getppid() != 1) {
log_error("This program should be invoked by init only.");
if (getppid() != 1) {
log_error("This program should be invoked by init only.");
- return
1
;
+ return
EXIT_FAILURE
;
}
if (argc > 1) {
log_error("This program does not take arguments.");
}
if (argc > 1) {
log_error("This program does not take arguments.");
- return
1
;
+ return
EXIT_FAILURE
;
}
log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
log_parse_environment();
}
log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
log_parse_environment();
+ log_open();
if ((n = sd_listen_fds(true)) < 0) {
log_error("Failed to read listening file descriptors from environment: %s", strerror(-r));
if ((n = sd_listen_fds(true)) < 0) {
log_error("Failed to read listening file descriptors from environment: %s", strerror(-r));
- return
1
;
+ return
EXIT_FAILURE
;
}
if (n <= 0 || n > SERVER_FD_MAX) {
log_error("No or too many file descriptors passed.");
}
if (n <= 0 || n > SERVER_FD_MAX) {
log_error("No or too many file descriptors passed.");
- return
2
;
+ return
EXIT_FAILURE
;
}
if (server_init(&server, (unsigned) n) < 0)
}
if (server_init(&server, (unsigned) n) < 0)
- return
2
;
+ return
EXIT_FAILURE
;
log_debug("systemd-initctl running as pid %lu", (unsigned long) getpid());
log_debug("systemd-initctl running as pid %lu", (unsigned long) getpid());
@@
-391,7
+393,7
@@
int main(int argc, char *argv[]) {
goto fail;
}
goto fail;
}
- r =
0
;
+ r =
EXIT_SUCCESS
;
log_debug("systemd-initctl stopped as pid %lu", (unsigned long) getpid());
log_debug("systemd-initctl stopped as pid %lu", (unsigned long) getpid());