[systemd-commits] 4 commits - src/execute.c src/service.c src/util.c
Lennart Poettering
lennart at kemper.freedesktop.org
Mon Jul 12 13:05:57 PDT 2010
src/execute.c | 13 +++++++++----
src/service.c | 3 ++-
src/util.c | 15 ++++++++++++++-
3 files changed, 25 insertions(+), 6 deletions(-)
New commits:
commit 21d21ea42eadd742873c2bddfd474e3b34510431
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Jul 12 22:04:59 2010 +0200
execute: inherit from original input, not the fixed up
diff --git a/src/execute.c b/src/execute.c
index 9fe0a05..6b6c285 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -308,6 +308,10 @@ static int setup_output(const ExecContext *context, int socket_fd, const char *i
case EXEC_OUTPUT_INHERIT:
+ /* If input got downgraded, inherit the original value */
+ if (i == EXEC_INPUT_NULL && is_terminal_input(context->std_input))
+ return open_terminal_as(tty_path(context), O_WRONLY, STDOUT_FILENO);
+
/* If the input is connected to anything that's not a /dev/null, inherit that... */
if (i != EXEC_INPUT_NULL)
return dup2(STDIN_FILENO, STDOUT_FILENO) < 0 ? -errno : STDOUT_FILENO;
@@ -360,10 +364,11 @@ static int setup_error(const ExecContext *context, int socket_fd, const char *id
if (e == EXEC_OUTPUT_INHERIT &&
o == EXEC_OUTPUT_INHERIT &&
i == EXEC_INPUT_NULL &&
+ !is_terminal_input(context->std_input) &&
getppid () != 1)
return STDERR_FILENO;
- /* Duplicate form stdout if possible */
+ /* Duplicate from stdout if possible */
if (e == o || e == EXEC_OUTPUT_INHERIT)
return dup2(STDOUT_FILENO, STDERR_FILENO) < 0 ? -errno : STDERR_FILENO;
commit 5830833f7c09b7584f59d048cf8535dc42ea9846
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Jul 12 21:56:51 2010 +0200
service: allow input from terminal when executing more than one start-pre or stop-post command
diff --git a/src/service.c b/src/service.c
index 4710850..646749e 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1846,7 +1846,8 @@ static void service_run_next(Service *s, bool success) {
false,
!s->permissions_start_only,
!s->root_directory_start_only,
- false,
+ s->control_command_id == SERVICE_EXEC_START_PRE ||
+ s->control_command_id == SERVICE_EXEC_STOP_POST,
false,
&s->control_pid)) < 0)
goto fail;
commit 85d73053f2eb6c3cfff18d184e13b0d536e34c17
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Jul 12 21:53:36 2010 +0200
execute: reword comment
diff --git a/src/execute.c b/src/execute.c
index 5483b69..9fe0a05 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -968,9 +968,9 @@ int exec_spawn(ExecCommand *command,
goto fail;
}
- /* Close sockets very early to make sure we don' block
- * init reexecution because it cannot bind its sockets
- * or so */
+ /* Close sockets very early to make sure we don't
+ * block init reexecution because it cannot bind its
+ * sockets */
if (close_all_fds(fds, n_fds) < 0) {
r = EXIT_FDS;
goto fail;
commit 3fe5e5d476f6a653e303913aff6c438807b80b3b
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Jul 12 21:40:43 2010 +0200
util: reset terminal even harder
diff --git a/src/util.c b/src/util.c
index b5513dd..e5d8456 100644
--- a/src/util.c
+++ b/src/util.c
@@ -47,6 +47,7 @@
#include <sys/utsname.h>
#include <pwd.h>
#include <netinet/ip.h>
+#include <linux/kd.h>
#include "macro.h"
#include "util.h"
@@ -1844,10 +1845,22 @@ int ask(char *ret, const char *replies, const char *text, ...) {
int reset_terminal(int fd) {
struct termios termios;
int r = 0;
+ long arg;
+
+ /* Set terminal to some sane defaults */
assert(fd >= 0);
- /* Set terminal to some sane defaults */
+ /* First, unlock termios */
+ zero(termios);
+ ioctl(fd, TIOCSLCKTRMIOS, &termios);
+
+ /* Disable exclusive mode, just in case */
+ ioctl(fd, TIOCNXCL);
+
+ /* Enable console unicode mode */
+ arg = K_UNICODE;
+ ioctl(fd, KDSKBMODE, &arg);
if (tcgetattr(fd, &termios) < 0) {
r = -errno;
More information about the systemd-commits
mailing list