Use some magic devices to prevent users hurting themselves with --file-read=/dev/stdin as we re-use fd 0
This commit is contained in:
@@ -146,7 +146,7 @@ bool opts_add_exec_send_receive(char *arg) {
|
||||
}
|
||||
|
||||
bool opts_add_stdin(char __attribute__((unused)) *arg) {
|
||||
int fd = fcntl(0, F_DUPFD_CLOEXEC, 0);
|
||||
int fd = fcntl(STDIN_FILENO, F_DUPFD_CLOEXEC, 0);
|
||||
assert(fd >= 0);
|
||||
return flow_new_send_hello(fd, receive_flow, NULL, NULL);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ bool opts_add_stdout(char *arg) {
|
||||
if (!serializer) {
|
||||
return false;
|
||||
}
|
||||
int fd = fcntl(1, F_DUPFD_CLOEXEC, 0);
|
||||
int fd = fcntl(STDOUT_FILENO, F_DUPFD_CLOEXEC, 0);
|
||||
assert(fd >= 0);
|
||||
return flow_new_send_hello(fd, send_flow, serializer, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user