From: Otto Moerbeek Date: Mon, 14 Sep 2020 12:46:03 +0000 (+0200) Subject: Allow dump-cache stdout X-Git-Tag: dnsdist-1.6.0-alpha2~39^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3be819587703279c3114f335467bf01dd56ecde;p=thirdparty%2Fpdns.git Allow dump-cache stdout (a hyphen does not work due to the "funny" command line parser) --- diff --git a/pdns/rec_control.cc b/pdns/rec_control.cc index 513a56332d..de42be53ef 100644 --- a/pdns/rec_control.cc +++ b/pdns/rec_control.cc @@ -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));