Re: [PATCH] Move wpa_cli_history default to $XDG_DATA_HOME and fallback to $HOME

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux