chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update fixme
[elogind.git]
/
src
/
execute.c
diff --git
a/src/execute.c
b/src/execute.c
index 5483b6949eae57814eb14236e4a5f1104d1c69a5..b4ddf8961f390071f690be5c588e01cb8d247917 100644
(file)
--- a/
src/execute.c
+++ b/
src/execute.c
@@
-1,4
+1,4
@@
-/*-*- Mode: C; c-basic-offset: 8 -*-*/
+/*-*- Mode: C; c-basic-offset: 8
; indent-tabs-mode: nil
-*-*/
/***
This file is part of systemd.
/***
This file is part of systemd.
@@
-308,6
+308,10
@@
static int setup_output(const ExecContext *context, int socket_fd, const char *i
case EXEC_OUTPUT_INHERIT:
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;
/* 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 &&
if (e == EXEC_OUTPUT_INHERIT &&
o == EXEC_OUTPUT_INHERIT &&
i == EXEC_INPUT_NULL &&
+ !is_terminal_input(context->std_input) &&
getppid () != 1)
return STDERR_FILENO;
getppid () != 1)
return STDERR_FILENO;
- /* Duplicate f
or
m stdout if possible */
+ /* Duplicate f
ro
m stdout if possible */
if (e == o || e == EXEC_OUTPUT_INHERIT)
return dup2(STDOUT_FILENO, STDERR_FILENO) < 0 ? -errno : STDERR_FILENO;
if (e == o || e == EXEC_OUTPUT_INHERIT)
return dup2(STDOUT_FILENO, STDERR_FILENO) < 0 ? -errno : STDERR_FILENO;
@@
-968,10
+973,11
@@
int exec_spawn(ExecCommand *command,
goto fail;
}
goto fail;
}
- /* Close sockets very early to make sure we don' block
- * init reexecution because it cannot bind its sockets
- * or so */
- if (close_all_fds(fds, n_fds) < 0) {
+ /* Close sockets very early to make sure we don't
+ * block init reexecution because it cannot bind its
+ * sockets */
+ if (close_all_fds(socket_fd >= 0 ? &socket_fd : fds,
+ socket_fd >= 0 ? 1 : n_fds) < 0) {
r = EXIT_FDS;
goto fail;
}
r = EXIT_FDS;
goto fail;
}
@@
-1049,7
+1055,7
@@
int exec_spawn(ExecCommand *command,
}
if (cgroup_bondings)
}
if (cgroup_bondings)
- if (
(r = cgroup_bonding_install_list(cgroup_bondings, 0)
) < 0) {
+ if (
cgroup_bonding_install_list(cgroup_bondings, 0
) < 0) {
r = EXIT_CGROUP;
goto fail;
}
r = EXIT_CGROUP;
goto fail;
}