]> git.itanic.dy.fi Git - rrdd/blobdiff - process.c
process: run_piped_stream: Use correct direction with fdopen()
[rrdd] / process.c
index 12b77aa69821810137f7eec567d66aaebd9c1527..f7477b532697fa257c79e22927629a7974c717c7 100644 (file)
--- a/process.c
+++ b/process.c
@@ -516,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);
@@ -525,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);