mirror of
https://github.com/transmission/transmission.git
synced 2026-02-14 23:19:34 +00:00
fix: crash on invalid command-line value for --cache / -e arg (#8147)
* fix: crash on invalid command-line value for --cache arg * Update utils/remote.cc Co-authored-by: Yat Ho <lagoho7@gmail.com> --------- Co-authored-by: Yat Ho <lagoho7@gmail.com>
This commit is contained in:
@@ -2878,7 +2878,15 @@ int process_args(char const* rpcurl, int argc, char const* const* argv, RemoteCo
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
args.insert_or_assign(TR_KEY_cache_size_mib, tr_num_parse<int64_t>(optarg_sv).value());
|
||||
if (auto val = tr_num_parse<int64_t>(optarg_sv))
|
||||
{
|
||||
args.insert_or_assign(TR_KEY_cache_size_mib, *val);
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::print(stderr, "Argument to '-e'/'--cache' should be an integer");
|
||||
status |= EXIT_FAILURE;
|
||||
}
|
||||
break;
|
||||
|
||||
case 910:
|
||||
|
||||
Reference in New Issue
Block a user