From fa295235c6f6246952192c2f900c2ef2735f312a Mon Sep 17 00:00:00 2001 From: Hiroshi Inoue Date: Wed, 21 Apr 2021 15:39:41 +0900 Subject: [PATCH] Prioritize DISABLE_KEEPALIVE checkbox over the disable_keepalive bit of ExtraOptions. --- dlg_specific.c | 12 +++++++----- dlg_wingui.c | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dlg_specific.c b/dlg_specific.c index 82a40b8..6ac37f7 100644 --- a/dlg_specific.c +++ b/dlg_specific.c @@ -71,9 +71,9 @@ UInt4 getExtraOptions(const ConnInfo *ci) return flag; } -CSTR hex_format = "%x"; -CSTR dec_format = "%u"; -CSTR octal_format = "%o"; +CSTR hex_format = "%x%s"; +CSTR dec_format = "%u%s"; +CSTR octal_format = "%o%s"; static UInt4 replaceExtraOptions(ConnInfo *ci, UInt4 flag, BOOL overwrite) { if (overwrite) @@ -101,7 +101,7 @@ static UInt4 replaceExtraOptions(ConnInfo *ci, UInt4 flag, BOOL overwrite) } BOOL setExtraOptions(ConnInfo *ci, const char *optstr, const char *format) { - UInt4 flag = 0; + UInt4 flag = 0, cnt; if (!format) { @@ -126,7 +126,9 @@ BOOL setExtraOptions(ConnInfo *ci, const char *optstr, const char *format) format = dec_format; } - if (sscanf(optstr, format, &flag) < 1) + if (cnt = sscanf(optstr, format, &flag), cnt < 1) + return FALSE; + else if (cnt > 1) return FALSE; replaceExtraOptions(ci, flag, TRUE); return TRUE; diff --git a/dlg_wingui.c b/dlg_wingui.c index 471ccd0..6f2476e 100644 --- a/dlg_wingui.c +++ b/dlg_wingui.c @@ -582,6 +582,7 @@ ds_options_update(HWND hdlg, ConnInfo *ci) /* TCP KEEPALIVE */ ci->disable_keepalive = IsDlgButtonChecked(hdlg, DS_DISABLE_KEEPALIVE); + ci->extra_opts = getExtraOptions(ci); if (ci->disable_keepalive) { ci->keepalive_idle = -1; -- 2.39.5