summaryrefslogtreecommitdiff
path: root/Userland/Utilities/ping.cpp
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2023-03-01 00:11:43 +0330
committerAndreas Kling <kling@serenityos.org>2023-03-01 10:47:19 +0100
commit500044906d1b90f1c8b1a2f5675a2f82ab92b758 (patch)
tree7d6aae259b188c1b6879c591eebdfd7f55d9b71c /Userland/Utilities/ping.cpp
parent60908adcbe2afd611233957bb3126f736eb18e25 (diff)
downloadserenity-500044906d1b90f1c8b1a2f5675a2f82ab92b758.zip
LibCore+Everywhere: Remove ArgsParser::add*(char const*&)
This is not guaranteed to always work correctly as ArgsParser deals in StringViews and might have a non-properly-null-terminated string as a value. As a bonus, using StringView (and DeprecatedString where necessary) leads to nicer looking code too :^)
Diffstat (limited to 'Userland/Utilities/ping.cpp')
-rw-r--r--Userland/Utilities/ping.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Utilities/ping.cpp b/Userland/Utilities/ping.cpp
index cb5796d788..9f09d14f80 100644
--- a/Userland/Utilities/ping.cpp
+++ b/Userland/Utilities/ping.cpp
@@ -30,7 +30,7 @@ static Optional<size_t> count;
static uint32_t total_ms;
static int min_ms;
static int max_ms;
-static char const* host;
+static DeprecatedString host;
static int payload_size = -1;
// variable part of header can be 0 to 40 bytes
// https://datatracker.ietf.org/doc/html/rfc791#section-3.1
@@ -88,7 +88,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)));
- auto* hostent = gethostbyname(host);
+ auto* hostent = gethostbyname(host.characters());
if (!hostent) {
warnln("Lookup failed for '{}'", host);
return 1;