Careful, in many cases C will happily automatically and silently coerce unsigned values to signed values for your check if the types differ. Some functions may be actually intentionally returning numbers that large indicating success and your program might be invoking error handling code assuming a failure.
There's no good substitute for reading the RETURN VALUE(S) section the manpage for every function and testing appropriately.
There's no good substitute for reading the RETURN VALUE(S) section the manpage for every function and testing appropriately.