btmgmt: add non-interactive quit on read-sysconfig
authorYun-Hao Chung <howardchung@chromium.org>
Tue, 31 Aug 2021 05:44:36 +0000 (13:44 +0800)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:36 +0000 (19:08 +0530)
This fixes the erros that read-sysconfig doesn't exit in non-interactive
mode.

Reviewed-by: Archie Pusaka <apusaka@chromium.org>
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
tools/btmgmt.c

index 20dfa28..8697930 100755 (executable)
@@ -1905,17 +1905,18 @@ static void read_sysconfig_rsp(uint8_t status, uint16_t len, const void *param,
        if (status != 0) {
                error("Read system configuration failed with status "
                                "0x%02x (%s)", status, mgmt_errstr(status));
-               return;
+               return bt_shell_noninteractive_quit(EXIT_FAILURE);
        }
 
        tlv_list = mgmt_tlv_list_load_from_buf(param, len);
        if (!tlv_list) {
                error("Unable to parse response of read system configuration");
-               return;
+               return bt_shell_noninteractive_quit(EXIT_FAILURE);
        }
 
        mgmt_tlv_list_foreach(tlv_list, print_mgmt_tlv, NULL);
        mgmt_tlv_list_free(tlv_list);
+       bt_shell_noninteractive_quit(EXIT_SUCCESS);
 }
 
 static void cmd_read_sysconfig(int argc, char **argv)