ACK: [PATCH 2/2][V2] lib: fwts_ac_adapter: fix failing to find AC directory

Colin Ian King colin.king at canonical.com
Thu Jan 10 17:27:46 UTC 2019


On 10/01/2019 17:21, Alex Hung wrote:
> Some BIOS names adapter device "AC" which has length of 2. As a result,
> it always fails to get AC directory. This removes the condition to have
> directory name greater than 2.
> 
> Signed-off-by: Alex Hung <alex.hung at canonical.com>
> ---
>  src/lib/src/fwts_ac_adapter.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/lib/src/fwts_ac_adapter.c b/src/lib/src/fwts_ac_adapter.c
> index 853cf222..502b1f8f 100644
> --- a/src/lib/src/fwts_ac_adapter.c
> +++ b/src/lib/src/fwts_ac_adapter.c
> @@ -101,7 +101,7 @@ int fwts_ac_adapter_get_state(const int state, int *matching, int *not_matching)
>  
>  	do {
>  		entry = readdir(ac_power_dir);
> -		if (entry && strlen(entry->d_name) > 2) {
> +		if (entry && entry->d_name[0] != '.') {
>  			char path[PATH_MAX];
>  			char *data;
>  
> 

Acked-by: Colin Ian King <colin.king at canonical.com>



More information about the fwts-devel mailing list