]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Allow dump-cache stdout
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 14 Sep 2020 12:46:03 +0000 (14:46 +0200)
committerOtto <otto.moerbeek@open-xchange.com>
Mon, 15 Feb 2021 08:09:11 +0000 (09:09 +0100)
(a hyphen does not work due to the "funny" command line parser)

pdns/rec_control.cc

index 513a56332d92a81f58943900164fa26b1bdd24e5..de42be53ef3ede0a444c063150763fef54a7129b 100644 (file)
@@ -106,7 +106,12 @@ try
       command+=" ";
     command+=commands[i];
     if (commands[i] == "dump-cache" && i+1 < commands.size()) {
-      fd = open(commands[++i].c_str(), O_CREAT | O_EXCL | O_WRONLY, 0660);
+      ++i;
+      if (commands[i] == "stdout") {
+        fd = STDOUT_FILENO;
+      } else {
+        fd = open(commands[i].c_str(), O_CREAT | O_EXCL | O_WRONLY, 0660);
+      }
       if (fd == -1) {
         int err = errno;
         throw PDNSException("Error opening dump file for writing: " + stringerror(err));