[PATCH] Move wpa_cli_history default to $XDG_DATA_HOME and fallback to $HOME
Jouni Malinen
j at w1.fi
Sun May 22 06:26:09 PDT 2022
On Sat, May 21, 2022 at 03:03:49PM +0900, gyara wrote:
> ---
> This patch try use $XDG_DATA_HOME/.wpa_cli_history as wpa cli hist file
> path prefer than $HOME/.wpa_cli_history.
Why?
This patch would also need to come with the Signed-off-by: line as
described in the top level CONTRIBUTIONS file for me to be able to
consider applying it.
> static void start_edit(void)
> {
> - char *home;
> + char *hist_home;
That seems unnecessary.
> @@ -4644,16 +4644,21 @@ static void start_edit(void)
> #endif /* CONFIG_CTRL_IFACE_UDP_REMOTE */
>
> #ifdef CONFIG_WPA_CLI_HISTORY_DIR
> - home = CONFIG_WPA_CLI_HISTORY_DIR;
> + hist_home = CONFIG_WPA_CLI_HISTORY_DIR;
This is unnecessary complexity..
> #else /* CONFIG_WPA_CLI_HISTORY_DIR */
> - home = getenv("HOME");
> + char* xdg_data_home = getenv("XDG_DATA_HOME");
> + if (xdg_data_home) {
> + hist_home = xdg_data_home;
> + } else {
> + hist_home = getenv("HOME");
> + }
home = getenv("XDG_DATA_HOME");
if (!home)
home = getenv("HOME")
would be a much simpler way of doing all of this..
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list