Skip to content

Commit

Permalink
Improve error handling for invalid port numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
BalliAsghar committed Aug 12, 2023
1 parent 970cc3f commit e7e7e27
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion killport
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ else
fi

# Validate the port number
if ! ((port >= 1 && port <= 65535)); then
if ! expr "$port" + 1 >/dev/null 2>&1 || ! ((port >= 1 && port <= 65535)); then
echo -e "${RED}Invalid port number: $port${NC}" >&2
exit 1
elif ((port <= 1023)); then
Expand Down

0 comments on commit e7e7e27

Please sign in to comment.