exec: increase maximum execution time to 120s
[project/rpcd.git] / exec.c
diff --git a/exec.c b/exec.c
index c03e450a6cd46db22c8b7cdc4f0f6a719fec8fb3..146e62b6fd4bf9b01d413a3cf8e9b7e292134ef8 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -1,7 +1,7 @@
 /*
  * rpcd - UBUS RPC server
  *
- *   Copyright (C) 2013 Jo-Philipp Wich <jow@openwrt.org>
+ *   Copyright (C) 2013-2014 Jo-Philipp Wich <jow@openwrt.org>
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -26,7 +26,7 @@
 #include <sys/stat.h>
 #include <sys/wait.h>
 
-#include "exec.h"
+#include <rpcd/exec.h>
 
 static int
 rpc_errno_status(void)
@@ -50,7 +50,7 @@ rpc_errno_status(void)
        }
 }
 
-static const char *
+const char *
 rpc_exec_lookup(const char *cmd)
 {
        struct stat s;
@@ -175,6 +175,12 @@ rpc_exec_process_cb(struct uloop_process *p, int stat)
 
        ustream_poll(&c->opipe.stream);
        ustream_poll(&c->epipe.stream);
+
+       close(c->opipe.fd.fd);
+       close(c->epipe.fd.fd);
+
+       ustream_poll(&c->opipe.stream);
+       ustream_poll(&c->epipe.stream);
 }
 
 static void
@@ -344,7 +350,7 @@ rpc_exec(const char **args, rpc_exec_write_cb_t in,
                uloop_process_add(&c->process);
 
                c->timeout.cb = rpc_exec_timeout_cb;
-               uloop_timeout_set(&c->timeout, RPC_EXEC_MAX_RUNTIME);
+               uloop_timeout_set(&c->timeout, exec_timeout);
 
                if (c->stdin_cb)
                {