Skip to content

Commit

Permalink
Services/EchoServer: Print a helpful error message instead of crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
ninadsachania committed Nov 6, 2024
1 parent 95bbb2d commit 3a18b11
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Userland/Services/EchoServer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
exit(1);
}

if (port < 1024 && geteuid() != 0) {
warnln("Listening on port {} require root privileges", port);
exit(1);
}

Core::EventLoop event_loop;

auto server = TRY(Core::TCPServer::try_create());
Expand Down

0 comments on commit 3a18b11

Please sign in to comment.