On Mon, Jan 4, 2016 at 12:42 PM, Ingo Schwarze <[email protected]> wrote: > Michael McConville wrote on Mon, Jan 04, 2016 at 01:12:56PM -0500: >> Theo Buehler wrote: > >>> CVSROOT: /cvs >>> Module name: src >>> Changes by: [email protected] 2016/01/04 03:59:23 >>> >>> Modified files: >>> usr.bin/make : main.c >>> >>> Log message: >>> Use err(3) instead of various handrolled combinations of perror(3) and >>> fprintf(stderr, ...) with strerror(3) and exit(3). Make sure the exit >>> status is 2 if an error occurred. Prompted by gsoares@'s and jsg@'s >>> audit of exit statuses after failure of pledge(2). >>> >>> ok gsoares@ > >> Note that while most err.h functions are in glibc and even musl, they >> aren't standardized. Because of this, a few things in base such as >> LibreSSL and OpenSSH use perror/exit instead. I don't know whether this >> is relevant to make, but I thought it was worth mentioning. > > Also note that even if you want to maintain a portable version > of some OpenBSD software, it isn't a bad approach to use good > interfaces anyway and bundle them, to be used only on systems > lacking them. Mandoc does that, for example. Here are the > relevant files from the portable version: > > http://mdocml.bsd.lv/cgi-bin/cvsweb/compat_err.c > http://mdocml.bsd.lv/cgi-bin/cvsweb/test-err.c > > They are short, and they are only needed in the portable tree, > not in the OpenBSD tree. >
Agreed! Don't let portability inhibit you here, since it's usually not much of a burden to bundle simple interfaces like this with the portable releases. LibreSSL portable bundles err.h already, since it is used in nc and the regression tests, though I should look at switching to mdoc's version for consistency...
