The inherent reason is that -1 is the most common error return code in C based APIs. The problem is not naively handling an error case, it's not handling an error case. Using a different value might avoid calling killall -1, but the program would still be incorrect.
This is the same sort of argument as strlcat vs strncat, and people can't agree on that one.
This is the same sort of argument as strlcat vs strncat, and people can't agree on that one.