]> git.itanic.dy.fi Git - rrdd/blobdiff - process.c
onewire_parser.c: Fix compiler warnings about string lengths
[rrdd] / process.c
index 2f5bccdc8a0d16c1c8602acaf2929710591fb2b7..f7477b532697fa257c79e22927629a7974c717c7 100644 (file)
--- a/process.c
+++ b/process.c
@@ -134,15 +134,17 @@ out_unlock:
         * ensures next time we start spawning worker threads
         * the first thread will have number zero on its name.
         */
-       if (!workers_active) {
+       if (!workers_active)
                worker_count = 0;
 
-               /*
-                * Kick the job poller, just to print the time of next
-                * update on the logs
-                */
-               notify_job_request();
-       }
+       /*
+        * Kick the job poller. If all jobs were active at this point
+        * the scheduler thread will wait indefinitely until someone
+        * tells it to do something. We may now know when next job is
+        * available, so it is better for the scheduler to recalculate
+        * its sleep time.
+        */
+       notify_job_request();
 
        mutex_unlock(&work_stats_mutex);
 
@@ -514,7 +516,7 @@ int run_piped_stream(const char *cmd, char *const argv[],
        pid = run_piped(cmd, argv, i, o, e);
 
        if (stdinf) {
-               *stdinf = fdopen(ifd, "r");
+               *stdinf = fdopen(ifd, "w");
                if (*stdinf == NULL) {
                        pr_err("Error opening file stream for fd %d: %m\n",
                               ifd);
@@ -523,7 +525,7 @@ int run_piped_stream(const char *cmd, char *const argv[],
        }
 
        if (stdoutf) {
-               *stdoutf = fdopen(ofd, "w");
+               *stdoutf = fdopen(ofd, "r");
                if (*stdoutf == NULL) {
                        pr_err("Error opening file stream for fd %d: %m\n",
                               ofd);