Is it necessary to check for errors after calling
According to the manual page:
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
and under the ERRORS heading,
EFAULT buf is not valid.
is the only error listed.
Can I assume, therefore, that
uname will never fail if given a valid
struct utsname buffer?
Best How To :
EFAULT is the only
errno listed, it doesn't mean
uname will never fail as long as you pass a valid buffer. It could fail for any other reason. i.e. if
uname's return code is
-1, then it failed irrespective of the value of
errno is only meaningful if the function/system call indicates failure; it doesn't, on its own, define the success/failure of a library function/syscall.