Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp911361pxb; Thu, 17 Feb 2022 18:16:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKp9SHaDMb3bm5giHTrKQ2yaxaqhKJ4Apy0C6U8qH0/EgwJegQsHhtXcl2iqvtnuoJr4vA X-Received: by 2002:a65:464b:0:b0:36c:58da:5892 with SMTP id k11-20020a65464b000000b0036c58da5892mr4601674pgr.439.1645150572108; Thu, 17 Feb 2022 18:16:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645150572; cv=none; d=google.com; s=arc-20160816; b=gtkYygviR/CA9K6SBF9bVYmOSUxuf/y9jJruf7AuwYIzEs0m0CIOPT0WnGY1FKCzyb Gc2yPtY2fOsaJWF9aijM7Ld4OKUJQ6d6icaIN7S70sbMbRqJhGpGS3wzJN0VdCC02PRs khqmhqd9yxsZNJH4wJQybtH588PX7+A8BxiGYHrUHlSgKoJ/fQODgmQrL/ay1KmEgYHX Hxf6nlCu/fSqRPeZf4XWhyAF/5F8cL80YFNRgFI2/AyHCktscDdMPmP6cnVRtkQtBzs8 qcMkSI6ov+/R6HLzxAmErCsJYrOE4ZY+mb7ccWwfmhb88id9FhHJXM+eiPaFr1QGbFLs j+Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=Z/h1YRsh6fLXRWLJjTrAi9809tNygUW1zBfzJzr6M7Q=; b=QfB7+l7ko5Ft7Kt6h7CsPm350vqdlg3WD2uLlPklpIqc69qKGEOLcU+2Hn22HnvvBV CUUl8rwcN2OqgV9R1OsSPWyxappleXpbfB/jmBOPjWlJtmIw6TaC8wSlosLOPx2iD0b2 KVV0KaOsvdi1tbA/tB1Cd7mwd/V1RynpQulgeVw/JAcAVdoWc5on3QF7eQ62s+JlilZ2 ogf+3iUfqnXGfXqQ7VtHp04u1KcdBaL3Cq98rZ7Cin8plbwBaxQCt2B31LTPVERXJiZt wXWrEvEunWIDj5wsAmEij+5sQR6bmddI7y5whr0c3hBSM1QlsgbW2eGDES7XKhJo/n/h iMJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PTgX7EV6; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id mq16si2407799pjb.19.2022.02.17.18.16.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 18:16:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PTgX7EV6; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D492A20A89F; Thu, 17 Feb 2022 18:16:09 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231467AbiBRCQX (ORCPT + 99 others); Thu, 17 Feb 2022 21:16:23 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:34410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231465AbiBRCQW (ORCPT ); Thu, 17 Feb 2022 21:16:22 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E42232042AC for ; Thu, 17 Feb 2022 18:16:06 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id v13-20020a17090ac90d00b001b87bc106bdso11061087pjt.4 for ; Thu, 17 Feb 2022 18:16:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Z/h1YRsh6fLXRWLJjTrAi9809tNygUW1zBfzJzr6M7Q=; b=PTgX7EV6EIKbcHQBLG0VjMqAmqnvO+AqHCOsXckB5H/5zsOzvegXKD5G7HIJU7uwBJ ZnxrDecXDC145pa20bqTlGA57b5D9UGvD98wtAlG+Gdu19vrPhJQP//LdEDGsmpD80E8 FwM+LRn2//sBHiR6QQspCB8xeKSi6lwuZmdi7lgKkPU1qlaUOpK70EjKyfLoD9kz/7Vr EhzZafQ+OMou4o15S0CesBiDQO5OQg6Km/UpdWd2s4X0yo/K4cGuwSNb3BhSPdYDlLtq yTjTxPtbDaNVkQqef4gFOIYz+JdY7+TkkhPpXNgjNuwBADnrPEr0xFuNzbDs1Gb7dIbu VmLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Z/h1YRsh6fLXRWLJjTrAi9809tNygUW1zBfzJzr6M7Q=; b=OcDusyygYpZ7QC0jHY4vDgaaM4DPYptZ/6K9K5gFCIPyxluhzLblARWnbGYg+o4Sxh N1/nYv5Hsthyx8JIc10l/m9afkBPVoo8/KEwa3U/LoUK6g5i+3EODe0z/IGfB3m5EYmR 5v+1luwsyrcYZ/7azroq48DIOhyN6J6R1QcVcN3HT7Zd7i2Sf1D5VCACQ3hgxZbrBPaO LNLdfINZXpSobH2ZQTeGOY13dxhM7gsn5z+SQEzJ0342FFRfpA/zzhmI/3PmGsaHBXRU KeCOoJH/+OYWkbB1IdBXhy+epHsjy4rCP5gc0bwt5R7yC6bZSzTJmxkWn41v/eQb6jUk mgvA== X-Gm-Message-State: AOAM532jXh9DzUrxrd8VULXiEYIP+F6yCo1LEpsNVjt/LxI+pu9Kbm8G RpNRfhrW16NBAaDg4XxFSg5NXGuTr/wl3A== X-Received: by 2002:a17:902:9045:b0:14f:14e7:f3aa with SMTP id w5-20020a170902904500b0014f14e7f3aamr5280514plz.69.1645150566101; Thu, 17 Feb 2022 18:16:06 -0800 (PST) Received: from lvondent-mobl4.intel.com (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id h14sm959640pfh.95.2022.02.17.18.16.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 18:16:05 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ] main.conf: Fix parsing of mode options Date: Thu, 17 Feb 2022 18:16:05 -0800 Message-Id: <20220218021605.3126182-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This replace the of g_key_file_get_integer which is limited to only decimal values to g_key_file_get_string and then use strtol to convert the string value to integer. Fixes: https://github.com/bluez/bluez/issues/293 --- src/main.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index bf9d398e4..a448320c1 100644 --- a/src/main.c +++ b/src/main.c @@ -354,13 +354,22 @@ static void parse_mode_config(GKeyFile *config, const char *group, for (i = 0; i < params_len; ++i) { GError *err = NULL; - int val = g_key_file_get_integer(config, group, - params[i].val_name, &err); + char *str; + + str = g_key_file_get_string(config, group, params[i].val_name, + &err); if (err) { DBG("%s", err->message); g_clear_error(&err); } else { - info("%s=%d", params[i].val_name, val); + char *endptr = NULL; + int val; + + val = strtol(str, &endptr, 0); + if (!endptr || *endptr != '\0') + continue; + + info("%s=%s(%d)", params[i].val_name, str, val); val = MAX(val, params[i].min); val = MIN(val, params[i].max); -- 2.35.1