]> git.meshlink.io Git - utcp/commit
Use '== -1' to check for errors from functions.
authorGuus Sliepen <guus@meshlink.io>
Sun, 11 Oct 2015 11:32:55 +0000 (13:32 +0200)
committerGuus Sliepen <guus@sliepen.org>
Sun, 2 Jul 2017 09:53:11 +0000 (11:53 +0200)
commit9c93346a7b4a539d111a2ebb1a95d70b394bc7f4
tree61ff5732201a81287af05fd31ad5de53fa66abeb
parentb570e123128f3fafa583bae186fd61429dcb49a7
Use '== -1' to check for errors from functions.

As made obvious by commit 123f53f, the type of ssize_t cannot be trusted
on Windows to actually be signed, so don't use '< 0', as the compiler
will optimize the test away. POSIX also specifies only that -1 signals
an error condition, not any other negative value.

Luckily, comparing an unsigned int to -1 still works as intended.
selftest.c
test.c