chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
units: in order to make the default services parseable by GKeyFile, merge repeated...
[elogind.git]
/
src
/
execute.c
diff --git
a/src/execute.c
b/src/execute.c
index 2acb11192d45f44d40b0c9aaf9028a2d73c3c38b..d7239d544000f40f8073d3c9c25e3263d26c0a8e 100644
(file)
--- a/
src/execute.c
+++ b/
src/execute.c
@@
-305,16
+305,16
@@
static int setup_output(const ExecContext *context, int socket_fd, const char *i
case EXEC_OUTPUT_INHERIT:
case EXEC_OUTPUT_INHERIT:
- /* If the input is connected to a
termina
l, inherit that... */
+ /* If the input is connected to a
nything that's not a /dev/nul
l, inherit that... */
if (i != EXEC_INPUT_NULL)
return dup2(STDIN_FILENO, STDOUT_FILENO) < 0 ? -errno : STDOUT_FILENO;
if (i != EXEC_INPUT_NULL)
return dup2(STDIN_FILENO, STDOUT_FILENO) < 0 ? -errno : STDOUT_FILENO;
- /* For PID 1 stdout is always connected to /dev/null,
- * hence reopen the console if out parent is PID1. */
- if (getppid() == 1)
- return open_terminal_as(tty_path(context), O_WRONLY, STDOUT_FILENO);
+ /* If we are not started from PID 1 we just inherit STDOUT from our parent process. */
+ if (getppid() != 1)
+ return STDOUT_FILENO;
- return STDOUT_FILENO;
+ /* We need to open /dev/null here anew, to get the
+ * right access mode. So we fall through */
case EXEC_OUTPUT_NULL:
return open_null_as(O_WRONLY, STDOUT_FILENO);
case EXEC_OUTPUT_NULL:
return open_null_as(O_WRONLY, STDOUT_FILENO);
@@
-356,7
+356,7
@@
static int setup_error(const ExecContext *context, int socket_fd, const char *id
* the way and are not on a tty */
if (e == EXEC_OUTPUT_INHERIT &&
o == EXEC_OUTPUT_INHERIT &&
* the way and are not on a tty */
if (e == EXEC_OUTPUT_INHERIT &&
o == EXEC_OUTPUT_INHERIT &&
- i
!
= EXEC_INPUT_NULL &&
+ i
=
= EXEC_INPUT_NULL &&
getppid () != 1)
return STDERR_FILENO;
getppid () != 1)
return STDERR_FILENO;