intmap *descs_by_fd = NULL; /**< Map of ports to DESC* objects */
static bool console_mode = 0;
+static int console_input, console_output;
static int sock = 0;
#ifdef HAS_OPENSSL
static int sslsock = 0;
else if (strcmp(argv[n], "--console") == 0) {
console_mode = 1;
detach_session = 0;
+ console_input = dup(STDIN_FILENO);
+ console_output = dup(STDOUT_FILENO);
} else if (strncmp(argv[n], "--pid-file", 10) == 0) {
char *eq;
if ((eq = strchr(argv[n], '=')))
int avail_descriptors;
unsigned long input_ready, output_ready;
int notify_fd = -1;
- int infd, outfd;
if (console_mode) {
- infd = dup(STDIN_FILENO);
- outfd = dup(STDOUT_FILENO);
- if (infd >= maxd)
- maxd = infd + 1;
- if (outfd >= maxd)
- maxd = outfd + 1;
-
- d = initializesock(infd, outfd, "localhost", "127.0.0.1", 0);
+ if (console_input >= maxd)
+ maxd = console_input + 1;
+ if (console_output >= maxd)
+ maxd = console_output + 1;
+
+ d = initializesock(console_input, console_output, "localhost", "127.0.0.1", 0);
sock = 0;
#ifdef HAS_OPENSSL