dnsdist: Save history to home-dir #4779
Merged
Conversation
a4d8d99
to
936c472
pdns/dnsdist-console.cc
Outdated
struct passwd pwd; | ||
struct passwd *result; | ||
char buf[16384]; | ||
getpwuid_r(getuid(), &pwd, buf, sizeof(buf), &result); |
rgacogne
Dec 20, 2016
Member
I'm wondering if we should use geteuid()
instead, in the unlikely event dnsdist
is started with -u
while in foreground mode.
I'm wondering if we should use geteuid()
instead, in the unlikely event dnsdist
is started with -u
while in foreground mode.
pdns/dnsdist-console.cc
Outdated
ret = string(pwd.pw_dir); | ||
if (homedir && !ignoreHOME) // $HOME overrides what the OS tells us | ||
ret = string(homedir); | ||
ret.append("/.dnsdist_history"); |
rgacogne
Dec 20, 2016
Member
How about not setting ret
to "."
beforehand and testing here if it's empty? If it is (somehow $HOME
or pwd.pw_dir
were empty or nothing worked), we could then fallback to "."
before appending "/.dnsdist_history"
. This would prevent trying to write in "/.dnsdist_history"
.
How about not setting ret
to "."
beforehand and testing here if it's empty? If it is (somehow $HOME
or pwd.pw_dir
were empty or nothing worked), we could then fallback to "."
before appending "/.dnsdist_history"
. This would prevent trying to write in "/.dnsdist_history"
.
936c472
to
9364403
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Short description
Only use CWD as a last resort. This prevents cluttering directories with
.dnsdist_history
filesCloses #4562
Checklist
I have: