From 0212db94eb34193e8c4927cd36a58264b2b414b4 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Sat, 15 Jun 2024 22:17:06 -0500 Subject: [PATCH] Fix segfault when run as rigctl --ptt-file=/dev/ttyUSB2 --ptt-type=RTS --- tests/rigctl.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/rigctl.c b/tests/rigctl.c index 12ddff9ee..e0f97d1c1 100644 --- a/tests/rigctl.c +++ b/tests/rigctl.c @@ -323,40 +323,40 @@ int main(int argc, char *argv[]) if (!strcmp(optarg, "RIG")) { - my_rig->caps->ptt_type = ptt_type = RIG_PTT_RIG; + ptt_type = RIG_PTT_RIG; } else if (!strcmp(optarg, "DTR")) { - my_rig->caps->ptt_type = ptt_type = RIG_PTT_SERIAL_DTR; + ptt_type = RIG_PTT_SERIAL_DTR; } else if (!strcmp(optarg, "RTS")) { - my_rig->caps->ptt_type = ptt_type = RIG_PTT_SERIAL_RTS; + ptt_type = RIG_PTT_SERIAL_RTS; } else if (!strcmp(optarg, "PARALLEL")) { - my_rig->caps->ptt_type = ptt_type = RIG_PTT_PARALLEL; + ptt_type = RIG_PTT_PARALLEL; } else if (!strcmp(optarg, "CM108")) { - my_rig->caps->ptt_type = ptt_type = RIG_PTT_CM108; + ptt_type = RIG_PTT_CM108; } else if (!strcmp(optarg, "GPIO")) { - my_rig->caps->ptt_type = ptt_type = RIG_PTT_GPIO; + ptt_type = RIG_PTT_GPIO; } else if (!strcmp(optarg, "GPION")) { - my_rig->caps->ptt_type = ptt_type = RIG_PTT_GPION; + ptt_type = RIG_PTT_GPION; } else if (!strcmp(optarg, "NONE")) { - my_rig->caps->ptt_type = ptt_type = RIG_PTT_NONE; + ptt_type = RIG_PTT_NONE; } else { puts("Unrecognised PTT type, using NONE"); - my_rig->caps->ptt_type = ptt_type = RIG_PTT_NONE; + ptt_type = RIG_PTT_NONE; } break; @@ -563,6 +563,7 @@ int main(int argc, char *argv[]) exit(2); } + my_rig->caps->ptt_type = ptt_type; char *token = strtok(conf_parms, ","); struct rig_state *rs = STATE(my_rig);