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:
9a6bca7
)
execute: simplify stdin/stderr/stdout fixup a little
author
Lennart Poettering
<lennart@poettering.net>
Wed, 19 May 2010 19:50:34 +0000
(21:50 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 19 May 2010 19:50:34 +0000
(21:50 +0200)
src/execute.c
patch
|
blob
|
history
diff --git
a/src/execute.c
b/src/execute.c
index d899a543f4e174561cea1145146333a748e9c78a..51e768893c83ff763921306926249cb1422fdbbd 100644
(file)
--- a/
src/execute.c
+++ b/
src/execute.c
@@
-227,31
+227,20
@@
static bool is_terminal_input(ExecInput i) {
i == EXEC_INPUT_TTY_FAIL;
}
i == EXEC_INPUT_TTY_FAIL;
}
-static int fixup_input(const ExecContext *context, int socket_fd) {
- assert(context);
+static int fixup_input(ExecInput std_input, int socket_fd) {
- if (s
ocket_fd < 0 && context->std_input == EXEC_INPUT_SOCKET
)
+ if (s
td_input == EXEC_INPUT_SOCKET && socket_fd < 0
)
return EXEC_INPUT_NULL;
return EXEC_INPUT_NULL;
- return context->std_input;
-}
-
-static int fixup_output(const ExecContext *context, int socket_fd) {
- assert(context);
-
- if (socket_fd < 0 && context->std_output == EXEC_OUTPUT_SOCKET)
- return EXEC_OUTPUT_INHERIT;
-
- return context->std_output;
+ return std_input;
}
}
-static int fixup_error(const ExecContext *context, int socket_fd) {
- assert(context);
+static int fixup_output(ExecOutput std_output, int socket_fd) {
- if (s
ocket_fd < 0 && context->std_error == EXEC_OUTPUT_SOCKET
)
+ if (s
td_output == EXEC_OUTPUT_SOCKET && socket_fd < 0
)
return EXEC_OUTPUT_INHERIT;
return EXEC_OUTPUT_INHERIT;
- return
context->std_error
;
+ return
std_output
;
}
static int setup_input(const ExecContext *context, int socket_fd) {
}
static int setup_input(const ExecContext *context, int socket_fd) {
@@
-259,7
+248,7
@@
static int setup_input(const ExecContext *context, int socket_fd) {
assert(context);
assert(context);
- i = fixup_input(context, socket_fd);
+ i = fixup_input(context
->std_input
, socket_fd);
switch (i) {
switch (i) {
@@
-302,8
+291,8
@@
static int setup_output(const ExecContext *context, int socket_fd, const char *i
assert(context);
assert(ident);
assert(context);
assert(ident);
- i = fixup_input(context, socket_fd);
- o = fixup_output(context, socket_fd);
+ i = fixup_input(context
->std_input
, socket_fd);
+ o = fixup_output(context
->std_output
, socket_fd);
/* This expects the input is already set up */
/* This expects the input is already set up */
@@
-347,9
+336,9
@@
static int setup_error(const ExecContext *context, int socket_fd, const char *id
assert(context);
assert(ident);
assert(context);
assert(ident);
- i = fixup_input(context, socket_fd);
- o = fixup_output(context, socket_fd);
- e = fixup_
error(context
, socket_fd);
+ i = fixup_input(context
->std_input
, socket_fd);
+ o = fixup_output(context
->std_output
, socket_fd);
+ e = fixup_
output(context->std_error
, socket_fd);
/* This expects the input and output are already set up */
/* This expects the input and output are already set up */