Philip Guenther <guent...@gmail.com> writes: > > On Sat, 8 Oct 2016, Gleydson Soares wrote: > > uname(3) function returns 0 on successful and -1 on failure. > > "non-negative value" is wrong here. > > Hmm, that's a direct quote from the standard. While our implementation > only returns zero on success, an application which checked for a return > value of exactly zero would be non-portable. > > > Philip
I stlumbled upon it, while reading uname(1) code. src/usr.bin/uname/uname.c:104 if (uname(&u)) err(1, NULL); Index: uname.c =================================================================== RCS file: /cvs/src/usr.bin/uname/uname.c,v retrieving revision 1.17 diff -u -p -r1.17 uname.c --- uname.c 24 Dec 2015 15:01:24 -0000 1.17 +++ uname.c 9 Oct 2016 18:41:31 -0000 @@ -101,7 +101,7 @@ main(int argc, char *argv[]) print_mask = PRINT_SYSNAME; } - if (uname(&u)) + if (uname(&u) == -1) err(1, NULL); if (print_mask & PRINT_SYSNAME) {