Garrett Cooper <yanef...@gmail.com> writes: > #include <err.h> > #include <errno.h> > #include <stdio.h> > #include <sys/types.h> > #include <sys/sysctl.h>
You should always put your sys includes before your non-sys includes, and in any case, <sys/types.h> should always come first. > printf("Errno: %d\n", errno); > errx(errno, "Error: %s", strerror(errno)); In addition to what everybody else said, errno is not an appropriate value for errx's first argument. Use 1 or EXIT_FAILURE (or one of the macros defined in <sysexits.h>, but I wouldn't recommend it). Also, you probably want to use err(), not errx(), and *always* compile with -Wall -Wextra, and unless you're going to run gdb on your program, -O2 (which enables additional code analysis) DES -- Dag-Erling Smørgrav - d...@des.no _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"