summaryrefslogtreecommitdiff
path: root/Userland/kill.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-11-08 02:07:08 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-11-08 02:07:08 +0100
commit41a751c90c9d39db764308aeba476db593b9b6e1 (patch)
treea681cb4ed2a5a89d4aa30dd130b8ccad3379ad88 /Userland/kill.cpp
parent71a2942a0a81a53831ade3c6dec106caafd29c5b (diff)
downloadserenity-41a751c90c9d39db764308aeba476db593b9b6e1.zip
Minor tweak to /bin/kill.
Diffstat (limited to 'Userland/kill.cpp')
-rw-r--r--Userland/kill.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Userland/kill.cpp b/Userland/kill.cpp
index 10cc9c1b62..7da6429270 100644
--- a/Userland/kill.cpp
+++ b/Userland/kill.cpp
@@ -6,6 +6,10 @@
static unsigned parseUInt(const String& str, bool& ok)
{
+ if (str.isEmpty()) {
+ ok = false;
+ return 0;
+ }
unsigned value = 0;
for (size_t i = 0; i < str.length(); ++i) {
if (str[i] < '0' || str[i] > '9') {
@@ -38,13 +42,13 @@ int main(int argc, char** argv)
print_usage_and_exit();
signum = parseUInt(&argv[1][1], ok);
if (!ok) {
- printf("%s is not a valid signal number\n", &argv[1][1]);
+ printf("'%s' is not a valid signal number\n", &argv[1][1]);
return 2;
}
}
unsigned pid = parseUInt(argv[pid_argi], ok);
if (!ok) {
- printf("%s is not a valid PID\n", argv[pid_argi]);
+ printf("'%s' is not a valid PID\n", argv[pid_argi]);
return 3;
}