diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-06-04 17:37:35 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-06-04 17:37:35 +0800 |
| commit | e30f6eb6872d57f7da764690589c2f0c9ffdb53b (patch) | |
| tree | ccb8e8f70bd491762341a2e3c89879e8ba96644e /src | |
| parent | 5c995442909c4a7cb135088930925b7cfa8bc675 (diff) | |
fix: consolidate port number validation logic
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp index e23877c..0ee7b3a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -47,12 +47,8 @@ int main(int argc, char *argv[]) try { return EXIT_SUCCESS; } else if (std::ranges::all_of(arg, ::isdigit)) { port = std::stoi(arg); - if (port < 0) { - log(ERR, "Port number must be greater than 0"); - - return EXIT_FAILURE; - } else if (port > 65535) { - log(ERR, "Port number must be less than 65536"); + if (port < 0 || port > 65535) { + log(ERR, "Port number must be between 0 and 65535"); return EXIT_FAILURE; } |
