Extract common "make private stats dir" code from rephist.c, geoip.c
In several places in rephist.c and geoip.c, we do: ``` /* Try to write to disk. */ statsdir = get_datadir_fname("stats"); if (check_private_dir(statsdir, CPD_CREATE, get_options()->User) < 0) { log_warn(LD_HIST, "Unable to create stats/ directory!"); goto done; } filename = get_datadir_fname2("stats", "buffer-stats"); if (write_str_to_file(filename, str, 0) < 0) log_warn(LD_HIST, "Unable to write buffer stats to disk!"); ``` Duplicated code is stupid. Some or all of this should get extracted into a new function or two. I'd suggest a function to "create the datadir and a subdirectory of the datadir as needed" and another function to write a file to a subdirectory of the datadir, creating that subdirectory as needed.
issue