chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5830833
)
execute: inherit from original input, not the fixed up
author
Lennart Poettering
<lennart@poettering.net>
Mon, 12 Jul 2010 20:04:59 +0000
(22:04 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Mon, 12 Jul 2010 20:04:59 +0000
(22:04 +0200)
src/execute.c
patch
|
blob
|
history
diff --git
a/src/execute.c
b/src/execute.c
index 9fe0a05767b2931a67045fed5fac69da2086e0cc..6b6c2855b48739c04febe6878c37d6370f3e3b11 100644
(file)
--- 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:
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;